Fix: dangling reference in the range-based for loop

This commit is contained in:
Mxr 2024-02-05 03:12:39 +08:00 committed by Charles Giessen
parent 2321c238d4
commit df5d11fc25

View File

@ -130,7 +130,7 @@ template <typename T> class Result {
const T& value () const& noexcept { assert (m_init); return m_value; } const T& value () const& noexcept { assert (m_init); return m_value; }
T& value () & noexcept { assert (m_init); return m_value; } T& value () & noexcept { assert (m_init); return m_value; }
const T&& value () const&& noexcept { assert (m_init); return std::move (m_value); } const T&& value () const&& noexcept { assert (m_init); return std::move (m_value); }
T&& value () && noexcept { assert (m_init); return std::move (m_value); } T value () && noexcept { assert (m_init); return std::move (m_value); }
// std::error_code associated with the error // std::error_code associated with the error
std::error_code error() const { assert (!m_init); return m_error.type; } std::error_code error() const { assert (!m_init); return m_error.type; }