mirror of
https://github.com/TartanLlama/expected.git
synced 2025-08-03 19:04:29 +02:00
Fixed missing decay in make_unexpected (ex: const lvalue expressions would create unexpected<T const&>, which would not compile)
This commit is contained in:
@@ -158,8 +158,8 @@ constexpr bool operator>=(const unexpected<E> &lhs, const unexpected<E> &rhs) {
|
|||||||
/// *Example:*
|
/// *Example:*
|
||||||
/// auto e1 = tl::make_unexpected(42);
|
/// auto e1 = tl::make_unexpected(42);
|
||||||
/// unexpected<int> e2 (42); //same semantics
|
/// unexpected<int> e2 (42); //same semantics
|
||||||
template <class E> unexpected<E> make_unexpected(E &&e) {
|
template <class E> unexpected<typename std::decay<E>::type> make_unexpected(E &&e) {
|
||||||
return unexpected<E>(std::forward<E>(e));
|
return unexpected<typename std::decay<E>::type>(std::forward<E>(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief A tag type to tell expected to construct the unexpected value
|
/// \brief A tag type to tell expected to construct the unexpected value
|
||||||
|
Reference in New Issue
Block a user