mirror of
https://github.com/TartanLlama/expected.git
synced 2025-08-02 18:34:29 +02:00
Constexpr fixes
This commit is contained in:
10
expected.hpp
10
expected.hpp
@@ -72,6 +72,12 @@
|
|||||||
#define TL_EXPECTED_CXX14
|
#define TL_EXPECTED_CXX14
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TL_EXPECTED_GCC49
|
||||||
|
#define TL_EXPECTED_GCC49_CONSTEXPR
|
||||||
|
#else
|
||||||
|
#define TL_EXPECTED_GCC49_CONSTEXPR constexpr
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (__cplusplus == 201103L || defined(TL_EXPECTED_MSVC2015) || \
|
#if (__cplusplus == 201103L || defined(TL_EXPECTED_MSVC2015) || \
|
||||||
defined(TL_EXPECTED_GCC49)) && \
|
defined(TL_EXPECTED_GCC49)) && \
|
||||||
!defined(TL_EXPECTED_GCC54)
|
!defined(TL_EXPECTED_GCC54)
|
||||||
@@ -1582,7 +1588,7 @@ public:
|
|||||||
|
|
||||||
/// \returns the contained value if there is one, otherwise throws [bad_expected_access]
|
/// \returns the contained value if there is one, otherwise throws [bad_expected_access]
|
||||||
/// \group value
|
/// \group value
|
||||||
constexpr const T &value() const & {
|
TL_EXPECTED_GCC49_CONSTEXPR const T &value() const & {
|
||||||
if (!has_value())
|
if (!has_value())
|
||||||
throw bad_expected_access<E>(err().value());
|
throw bad_expected_access<E>(err().value());
|
||||||
return val();
|
return val();
|
||||||
@@ -1594,7 +1600,7 @@ public:
|
|||||||
return val();
|
return val();
|
||||||
}
|
}
|
||||||
/// \group value
|
/// \group value
|
||||||
constexpr const T &&value() const && {
|
TL_EXPECTED_GCC49_CONSTEXPR const T &&value() const && {
|
||||||
if (!has_value())
|
if (!has_value())
|
||||||
throw bad_expected_access<E>(err().value());
|
throw bad_expected_access<E>(err().value());
|
||||||
return std::move(val());
|
return std::move(val());
|
||||||
|
Reference in New Issue
Block a user