omni::unexpected
Defined in omni/Expected.h
- 
template<typename TError>
 class unexpected : public omni::detail::UnexpectedImpl<TError>
- The unexpected value of an expected monad. This is used as a convenient mechanism to report the error case when constructing an - expectedreturn.- expected<string, Result> foo(bool x) { // C++17: TError is deduced as `Result` return unexpected(kResultNotImplemented); } - Public Functions - 
template<typename UError, typename IsNoexcept = std::enable_if_t<carb::cpp::conjunction<std::is_same<TError, UError>, typename omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_swappable, UError, std::true_type>::type>::value, typename omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_nothrow_swappable, UError, std::true_type>::type>>
 inline constexpr void swap(unexpected &other) noexcept(IsNoexcept::value)
- Swap the contents of this instance with other. - If - TErroris- noexceptswappable or if it is- void, this operation is also- noexcept.- Note - This function only participates in overload resolution if - TErroris swappable or is- void.
 - 
template<typename UError>
 inline constexpr bool operator==(unexpected<UError> const &other) const
- If - TErrorand- UErrorare not- void, then return- this->error() == other.error()if they are equality comparable (it is a compilation failure if they are not). If both- TErrorand- UErrorare- void, then return- true. If one is- voidand the other is not, this is a compilation failure.
 - Friends - 
template<typename UError, typename IsNoexcept = std::enable_if_t<omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_swappable, UError, std::true_type>::type::value, typename omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_nothrow_swappable, UError, std::true_type>::type>>
 inline friend constexpr void swap(unexpected &lhs, unexpected<UError> &rhs) noexcept(IsNoexcept::value)
- Swap the contents of lhs with rhs. - If - UErroris- noexceptswappable or if it is- void, this operation is also- noexcept.
 - 
template<typename UError>
 inline friend constexpr bool operator==(unexpected const &lhs, unexpected<UError> const &rhs)
- If - TErrorand- UErrorare not- void, then return- lhs.error() == rhs.error()if they are equality comparable (it is a compilation failure if they are not). If both- TErrorand- UErrorare- void, then return- true. If one is- voidand the other is not, this is a compilation failure.
 
- 
template<typename UError, typename IsNoexcept = std::enable_if_t<carb::cpp::conjunction<std::is_same<TError, UError>, typename omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_swappable, UError, std::true_type>::type>::value, typename omni::detail::ExpectedTransformIfNonVoid<carb::cpp::is_nothrow_swappable, UError, std::true_type>::type>>