and_then(_Fn&& __f) &
{
using _Up = __expected::__result<_Fn, _Tp&>;
- static_assert(__expected::__is_expected<_Up>);
- static_assert(is_same_v<typename _Up::error_type, _Er>);
+ static_assert(__expected::__is_expected<_Up>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Up::error_type, _Er>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected with the same error_type");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), _M_val);
and_then(_Fn&& __f) const &
{
using _Up = __expected::__result<_Fn, const _Tp&>;
- static_assert(__expected::__is_expected<_Up>);
- static_assert(is_same_v<typename _Up::error_type, _Er>);
+ static_assert(__expected::__is_expected<_Up>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Up::error_type, _Er>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected with the same error_type");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), _M_val);
and_then(_Fn&& __f) &&
{
using _Up = __expected::__result<_Fn, _Tp&&>;
- static_assert(__expected::__is_expected<_Up>);
- static_assert(is_same_v<typename _Up::error_type, _Er>);
+ static_assert(__expected::__is_expected<_Up>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Up::error_type, _Er>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected with the same error_type");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), std::move(_M_val));
and_then(_Fn&& __f) const &&
{
using _Up = __expected::__result<_Fn, const _Tp&&>;
- static_assert(__expected::__is_expected<_Up>);
- static_assert(is_same_v<typename _Up::error_type, _Er>);
+ static_assert(__expected::__is_expected<_Up>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Up::error_type, _Er>,
+ "the function passed to std::expected<T, E>::and_then "
+ "must return a std::expected with the same error_type");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), std::move(_M_val));
or_else(_Fn&& __f) &
{
using _Gr = __expected::__result<_Fn, _Er&>;
- static_assert(__expected::__is_expected<_Gr>);
- static_assert(is_same_v<typename _Gr::value_type, _Tp>);
+ static_assert(__expected::__is_expected<_Gr>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Gr::value_type, _Tp>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected with the same value_type");
if (has_value())
return _Gr(in_place, _M_val);
or_else(_Fn&& __f) const &
{
using _Gr = __expected::__result<_Fn, const _Er&>;
- static_assert(__expected::__is_expected<_Gr>);
- static_assert(is_same_v<typename _Gr::value_type, _Tp>);
+ static_assert(__expected::__is_expected<_Gr>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Gr::value_type, _Tp>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected with the same value_type");
if (has_value())
return _Gr(in_place, _M_val);
or_else(_Fn&& __f) &&
{
using _Gr = __expected::__result<_Fn, _Er&&>;
- static_assert(__expected::__is_expected<_Gr>);
- static_assert(is_same_v<typename _Gr::value_type, _Tp>);
+ static_assert(__expected::__is_expected<_Gr>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Gr::value_type, _Tp>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected with the same value_type");
if (has_value())
return _Gr(in_place, std::move(_M_val));
or_else(_Fn&& __f) const &&
{
using _Gr = __expected::__result<_Fn, const _Er&&>;
- static_assert(__expected::__is_expected<_Gr>);
- static_assert(is_same_v<typename _Gr::value_type, _Tp>);
+ static_assert(__expected::__is_expected<_Gr>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected");
+ static_assert(is_same_v<typename _Gr::value_type, _Tp>,
+ "the function passed to std::expected<T, E>::or_else "
+ "must return a std::expected with the same value_type");
if (has_value())
return _Gr(in_place, std::move(_M_val));
and_then(_Fn&& __f) &
{
using _Up = remove_cvref_t<invoke_result_t<_Fn, _Tp&>>;
- static_assert(__is_optional_v<remove_cvref_t<_Up>>);
+ static_assert(__is_optional_v<remove_cvref_t<_Up>>,
+ "the function passed to std::optional<T>::and_then "
+ "must return a std::optional");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), **this);
else
and_then(_Fn&& __f) const &
{
using _Up = remove_cvref_t<invoke_result_t<_Fn, const _Tp&>>;
- static_assert(__is_optional_v<_Up>);
+ static_assert(__is_optional_v<_Up>,
+ "the function passed to std::optional<T>::and_then "
+ "must return a std::optional");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), **this);
else
and_then(_Fn&& __f) &&
{
using _Up = remove_cvref_t<invoke_result_t<_Fn, _Tp>>;
- static_assert(__is_optional_v<remove_cvref_t<_Up>>);
+ static_assert(__is_optional_v<remove_cvref_t<_Up>>,
+ "the function passed to std::optional<T>::and_then "
+ "must return a std::optional");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), std::move(**this));
else
and_then(_Fn&& __f) const &&
{
using _Up = remove_cvref_t<invoke_result_t<_Fn, const _Tp>>;
- static_assert(__is_optional_v<remove_cvref_t<_Up>>);
+ static_assert(__is_optional_v<remove_cvref_t<_Up>>,
+ "the function passed to std::optional<T>::and_then "
+ "must return a std::optional");
if (has_value())
return std::__invoke(std::forward<_Fn>(__f), std::move(**this));
else
or_else(_Fn&& __f) const&
{
using _Up = invoke_result_t<_Fn>;
- static_assert( is_same_v<remove_cvref_t<_Up>, optional> );
+ static_assert(is_same_v<remove_cvref_t<_Up>, optional>,
+ "the function passed to std::optional<T>::or_else "
+ "must return a std::optional<T>");
if (has_value())
return *this;
or_else(_Fn&& __f) &&
{
using _Up = invoke_result_t<_Fn>;
- static_assert( is_same_v<remove_cvref_t<_Up>, optional> );
+ static_assert(is_same_v<remove_cvref_t<_Up>, optional>,
+ "the function passed to std::optional<T>::or_else "
+ "must return a std::optional<T>");
if (has_value())
return std::move(*this);