Simple-Utility v2.3.1
Loading...
Searching...
No Matches
sl::nullables Namespace Reference

Classes

class  adapter
 A adapter class, mimic the behaviour of nullable types. More...
 
struct  adapter_null_t
 Dedicated null type for adapters. More...
 
class  Algorithm
 The core algorithm helper, which executes the held operation when used as the right-hand-side of operator | expressions, when the left-hand-side is a valid nullable type. More...
 
struct  in_place_null_t
 Tag type for adapters, which can be used to disambiguate the construction with just a null-object. More...
 
struct  traits
 The main trait, which may be specialized from. More...
 
struct  traits< adapter< TNull, TAdapted > >
 Specialization for raw pointers. More...
 
struct  traits< std::optional< TArgs... > >
 Specialization for std::optional. More...
 
struct  traits< std::shared_ptr< TArgs... > >
 Specialization for std::shared_ptr. More...
 
struct  traits< std::unique_ptr< TArgs... > >
 Specialization for std::unique_ptr. More...
 
struct  traits< T >
 Specialization for raw pointers. More...
 
struct  traits< unique_handle< T, TDeleteAction > >
 Specialization for unique_handle types. More...
 

Concepts

concept  adaptable_with
 Determines whether the given adapted and null type satisfy the requirements to be used within a adapter.
 
concept  input_nullable
 Checks whether a type is an input_nullable.
 
concept  nullable
 Checks whether a type is nullable.
 

Typedefs

template<class T >
using adapted_value_t = std::remove_cvref_t< decltype(unwrap_adapted(std::declval< T >()))>
 
template<class T >
using value_t = typename traits< std::remove_cvref_t< T > >::value_type
 Convenience alias retrieving the value type of a nullable type.
 

Variables

constexpr detail::unwrap_adapted_fn unwrap_adapted {}
 
constexpr auto and_then
 Passes the value of the input_nullable to the function if it's not equal to its null-object. Returns the null-object otherwise.
 
template<class T >
static constexpr auto null_v {traits<std::remove_cvref_t<T>>::null}
 Convenience constant retrieving the null object of a nullable type.
 
constexpr detail::unwrap_fn unwrap {}
 Retrieves the value of the given input_nullable.
 
constexpr auto fwd_value
 Passes the value of the input_nullable to the function if it's not equal to its null-object.
 
constexpr auto or_else
 Returns the nullable if it's not equal to its ''null''-object. Executes the passed function otherwise.
 
constexpr auto value_or
 Retrieves the value of a input_nullable if it's not equal to its ''null''-object. Returns the alternative otherwise.
 

Variable Documentation

◆ unwrap_adapted

constexpr detail::unwrap_adapted_fn sl::nullables::unwrap_adapted {}
inlineconstexpr