6#ifndef SL_UTILITY_NULLABLES_VALUE_OR_HPP
7#define SL_UTILITY_NULLABLES_VALUE_OR_HPP
14namespace sl::nullables::detail
16 template <input_nullable TInputNullable, std::convertible_to<value_t<TInputNullable>> TAlternative>
18 constexpr value_t<TInputNullable>
value_or(TInputNullable&& inputNullable, TAlternative&& alternative)
20 if (inputNullable != null_v<TInputNullable>)
22 return value_t<TInputNullable>{
unwrap(std::forward<TInputNullable>(inputNullable))};
24 return value_t<TInputNullable>{std::forward<TAlternative>(alternative)};
27 class value_or_caller_fn
30 template <input_nullable TInputNullable, std::convertible_to<value_t<TInputNullable>> TAlternative>
32 constexpr value_t<TInputNullable> operator ()(
33 TInputNullable&& inputNullable,
34 TAlternative&& alternative
36 noexcept(
noexcept(
value_or(std::declval<TInputNullable>(), std::declval<TAlternative>())))
39 std::forward<TInputNullable>(inputNullable),
40 std::forward<TAlternative>(alternative)
73 inline constexpr auto value_or = []<
class Value>(
75 )
noexcept(std::is_nothrow_constructible_v<std::remove_cvref_t<Value>, Value>)
The core algorithm helper, which executes the held operation when used as the right-hand-side of oper...
Definition: base.hpp:216
Checks whether the given template type is usable as value type for unique_handle types.
Definition: unique_handle.hpp:161
constexpr auto bind_back
Helper function, which generates a forwarding call wrapper for the given function and curries the par...
Definition: bind_back.hpp:100
constexpr auto value_or
Retrieves the value of a input_nullable if it's not equal to its ''null''-object. Returns the alterna...
Definition: value_or.hpp:73
constexpr detail::unwrap_fn unwrap
Retrieves the value of the given input_nullable.
Definition: base.hpp:160
Definition: adapter.hpp:19