Skip to content

Commit

Permalink
feat: add inplace make_unexpected (#68, thanks @Leonezz)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonezz authored Jun 21, 2024
1 parent 182165b commit 958ae73
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/nonstd/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,18 @@ make_unexpected( E && value ) -> unexpected_type< typename std::decay<E>::type >
return unexpected_type< typename std::decay<E>::type >( std::forward<E>(value) );
}

template<
typename E, typename... Args,
typename = std::enable_if<
std::is_constructible<E, Args...>::value
>
>
nsel_constexpr14 auto
make_unexpected(in_place_t inplace, Args... args) -> unexpected_type< typename std::decay<E> >
{
return unexpected_type< typename std::decay<E>::type >(inplace, std::forward<Args>(args)...);
}

#if nsel_P0323R <= 3

/*nsel_constexpr14*/ auto inline
Expand Down

0 comments on commit 958ae73

Please sign in to comment.