|
constexpr | ~adapter () noexcept=default |
| Default destructor.
|
|
constexpr | adapter (const adapter &other) noexcept(std::is_nothrow_copy_constructible_v< TNull > &&std::is_nothrow_copy_constructible_v< TAdapted >)=default |
| Default copy constructor.
|
|
constexpr adapter & | operator= (const adapter &other) noexcept(std::is_nothrow_copy_assignable_v< TNull > &&std::is_nothrow_copy_assignable_v< TAdapted >)=default |
| Default copy assignment operator.
|
|
constexpr | adapter (adapter &&other) noexcept(std::is_nothrow_move_constructible_v< TNull > &&std::is_nothrow_move_constructible_v< TAdapted >)=default |
| Default move constructor.
|
|
constexpr adapter & | operator= (adapter &&other) noexcept(std::is_nothrow_move_assignable_v< TNull > &&std::is_nothrow_move_assignable_v< TAdapted >)=default |
| Default move assignment operator.
|
|
template<concepts::initializes< null_type > TNullArg>
requires std::constructible_from<adapted_type, const null_type&> |
constexpr | adapter (in_place_null_t, TNullArg &&nullArg) noexcept(std::is_nothrow_constructible_v< null_type, TNullArg > &&std::is_nothrow_constructible_v< adapted_type, const null_type & >) |
| Constructs the null object with the given argument and then constructs the adapted object with the null object.
|
|
constexpr | adapter (adapter_null_t) noexcept(std::is_nothrow_default_constructible_v< null_type > &&std::is_nothrow_constructible_v< adapted_type, null_type & >) |
| Default constructs the null object and then constructs the adapted object with the null object.
|
|
template<concepts::initializes< null_type > TNullArg>
requires concepts::not_same_as<adapter_null_t, std::remove_cvref_t<TNullArg>> && concepts::not_same_as<in_place_null_t, std::remove_cvref_t<TNullArg>> && (!detail::convertible_to_adapter<TNullArg>) && std::constructible_from<adapted_type, const null_type&> |
constexpr | adapter (TNullArg &&nullArg) noexcept(std::is_nothrow_constructible_v< adapter, std::in_place_t, TNullArg >) |
| Constructs the null object with the given argument and then constructs the adapted object with the null object.
|
|
template<concepts::initializes< null_type > TNullArg, concepts::initializes< adapted_type > TAdaptedArg>
requires concepts::not_same_as<adapter_null_t, std::remove_cvref_t<TNullArg>> && concepts::not_same_as<in_place_null_t, std::remove_cvref_t<TNullArg>> && concepts::not_same_as<adapter_null_t, std::remove_cvref_t<TAdaptedArg>> && concepts::not_same_as<in_place_null_t, std::remove_cvref_t<TAdaptedArg>> |
constexpr | adapter (TNullArg &&nullArg, TAdaptedArg &&adaptedArg) noexcept(std::is_nothrow_constructible_v< null_type, TNullArg > &&std::is_nothrow_constructible_v< adapted_type, TAdaptedArg >) |
| Constructs the null object and the adapted with the given arguments.
|
|
template<detail::convertible_to_adapter TArg>
requires concepts::not_same_as<adapter_null_t, std::remove_cvref_t<TArg>> && concepts::not_same_as<in_place_null_t, std::remove_cvref_t<TArg>> |
constexpr | adapter (TArg &&arg) noexcept(noexcept(to_nullables_adapter(std::forward< TArg >(arg))) &&std::is_nothrow_constructible_v< adapter >) |
| Constructs the adapter with the result of a to_nullables_adapter invocation.
|
|
constexpr adapter & | operator= (adapter_null_t) noexcept(std::is_nothrow_assignable_v< adapted_type &, null_type & >) |
| Assigns null to the adapted object.
|
|
template<concepts::assignable_to< adapted_type & > TAdaptedArg>
requires concepts::not_same_as<adapter_null_t, std::remove_cvref_t<TAdaptedArg>> |
constexpr adapter & | operator= (TAdaptedArg &&adaptedArg) noexcept(std::is_nothrow_assignable_v< adapted_type &, TAdaptedArg >) |
| Assigns the adapted object.
|
|
constexpr decltype(auto) | operator* () const & |
| Retrieves the value from the adapted object.
|
|
constexpr decltype(auto) | operator* () & |
| Retrieves the value from the adapted object.
|
|
constexpr decltype(auto) | operator* () && |
| Retrieves the value from the adapted object.
|
|
constexpr bool | operator== (adapter_null_t) const noexcept(concepts::nothrow_weakly_equality_comparable_with< TAdapted, TNull >) |
| Comparison operator with its adapter_null `object.
|
|
template<class TNull, adaptable_with< TNull > TAdapted>
requires std::same_as<TNull, std::remove_cvref_t<TNull>> && std::same_as<TAdapted, std::remove_cvref_t<TAdapted>>
class sl::nullables::adapter< TNull, TAdapted >
A adapter class, mimic the behaviour of nullable types.
- Template Parameters
-
TNull | The null type. |
TAdapted | The adapted type. |
This class aims to provide a layer of abstraction for types, which logically have a null-state but no dedicated null-object to compare with. For example an arbitrary iterator can be compared to its end iterator, but that end iterator usually must be retrieved from the container (unless end iterator is a dedicated sentinel type). adapter aims to fill the gap and therefore accepts a state object and a null object. The adapter itself can be then compared to its dedicated adapter_null
object and thus satisfying at least the input_nullable
concept. If the state object is then initializable and constructible via the given null-object, the nullable
concept is also satisfied.