Fixed missing decay in make_unexpected (ex: const lvalue expressions would create unexpected<T const&>, which would not compile)

This commit is contained in:
Kévin Alexandre Boissonneault
2017-12-03 22:11:12 -05:00
parent 759b9ae37a
commit da1f12b81b

View File

@@ -158,8 +158,8 @@ constexpr bool operator>=(const unexpected<E> &lhs, const unexpected<E> &rhs) {
/// *Example:*
/// auto e1 = tl::make_unexpected(42);
/// unexpected<int> e2 (42); //same semantics
template <class E> unexpected<E> make_unexpected(E &&e) {
return unexpected<E>(std::forward<E>(e));
template <class E> unexpected<typename std::decay<E>::type> make_unexpected(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