sparrow 0.9.0
|
#include <nullable.hpp>
Public Types | |
using | stored_value_type = T |
using | self_type = nullable<T, B> |
using | value_traits = nullable_traits<T> |
using | value_type = typename value_traits::value_type |
using | reference = typename value_traits::reference |
using | const_reference = typename value_traits::const_reference |
using | rvalue_reference = typename value_traits::rvalue_reference |
using | const_rvalue_reference = typename value_traits::const_rvalue_reference |
using | flag_traits = nullable_traits<B> |
using | flag_type = typename flag_traits::value_type |
using | flag_reference = typename flag_traits::reference |
using | flag_const_reference = typename flag_traits::const_reference |
using | flag_rvalue_reference = typename flag_traits::rvalue_reference |
using | flag_const_rvalue_reference = typename flag_traits::const_rvalue_reference |
Public Member Functions | |
template<std::default_initializable U = T, std::default_initializable BB = B> | |
constexpr | nullable () noexcept |
Default constructor creating a null nullable. | |
template<std::default_initializable U = T, std::default_initializable BB = B> | |
constexpr | nullable (nullval_t) noexcept |
Constructor from nullval_t creating a null nullable. | |
template<class U> requires (not std::same_as<self_type, std::decay_t<U>> and std::constructible_from<T, U &&>) | |
explicit (not std::convertible_to< U &&, T >) const expr nullable(U &&value) noexcept(noexcept(T(std::declval< U >()))) | |
Constructor from a value creating a non-null nullable. | |
constexpr | nullable (const self_type &rhs)=default |
Default copy constructor. | |
template<class TO, mpl::boolean_like BO> requires (impl::both_constructible_from_cref<T, TO, B, BO> and not impl::initializable_from_refs<T, nullable<TO, BO>>) | |
explicit (not impl::both_convertible_from_cref< T, TO, B, BO >) SPARROW_CONSTEXPR nullable(const nullable< TO | |
Converting copy constructor from different nullable types. | |
BO | m_null_flag (rhs.null_flag()) |
constexpr | nullable (self_type &&rhs) noexcept=default |
Default move constructor. | |
template<class TO, mpl::boolean_like BO> requires (impl::both_constructible_from_cond_ref<T, TO, B, BO> and not impl::initializable_from_refs<T, nullable<TO, BO>>) | |
explicit (not impl::both_convertible_from_cond_ref< T, TO, B, BO >) SPARROW_CONSTEXPR nullable(nullable< TO | |
Converting move constructor from different nullable types. | |
BO | m_null_flag (std::move(rhs).null_flag()) |
constexpr | nullable (value_type &&value, flag_type &&null_flag) |
Constructor from value and flag. | |
constexpr | nullable (std::add_lvalue_reference_t< T > value, std::add_lvalue_reference_t< B > null_flag) |
Constructor from lvalue references (for reference semantics). | |
constexpr | nullable (value_type &&value, std::add_lvalue_reference_t< B > null_flag) |
Constructor from moved value and flag reference. | |
constexpr | nullable (std::add_lvalue_reference_t< T > value, flag_type &&null_flag) |
Constructor from value reference and moved flag. | |
constexpr self_type & | operator= (nullval_t) noexcept |
Assignment from nullval_t, setting nullable to null state. | |
template<class TO> requires (not std::same_as<self_type, TO> and std::assignable_from<std::add_lvalue_reference_t<T>, TO>) | |
constexpr self_type & | operator= (TO &&rhs) noexcept |
Assignment from a value, setting nullable to non-null state. | |
constexpr self_type & | operator= (const self_type &rhs) noexcept |
Default copy assignment operator. | |
template<class TO, mpl::boolean_like BO> requires ( impl::both_assignable_from_cref<T, TO, B, BO> and not impl::initializable_from_refs<T, nullable<TO, BO>> and not impl::assignable_from_refs<T, nullable<TO, BO>> ) | |
constexpr self_type & | operator= (const nullable< TO, BO > &rhs) noexcept |
Converting assignment operator from different nullable types. | |
constexpr self_type & | operator= (self_type &&rhs) noexcept |
Default move assignment operator. | |
template<class TO, mpl::boolean_like BO> requires ( impl::both_assignable_from_cond_ref<T, TO, B, BO> and not impl::initializable_from_refs<T, nullable<TO, BO>> and not impl::assignable_from_refs<T, nullable<TO, BO>> ) | |
constexpr self_type & | operator= (nullable< TO, BO > &&rhs) noexcept |
Converting move assignment operator from different nullable types. | |
constexpr | operator bool () const noexcept |
Conversion to bool indicating non-null state. | |
constexpr bool | has_value () const noexcept |
Checks whether the nullable contains a valid value. | |
constexpr flag_reference | null_flag () &noexcept |
Gets mutable reference to the validity flag. | |
constexpr flag_const_reference | null_flag () const &noexcept |
Gets const reference to the validity flag. | |
constexpr flag_rvalue_reference | null_flag () &&noexcept |
Gets rvalue reference to the validity flag. | |
constexpr flag_const_rvalue_reference | null_flag () const &&noexcept |
Gets const rvalue reference to the validity flag. | |
constexpr reference | get () &noexcept |
Gets mutable reference to the stored value. | |
constexpr const_reference | get () const &noexcept |
Gets const reference to the stored value. | |
constexpr rvalue_reference | get () &&noexcept |
Gets rvalue reference to the stored value. | |
constexpr const_rvalue_reference | get () const &&noexcept |
Gets const rvalue reference to the stored value. | |
constexpr reference | value () & |
Gets mutable reference to the value with null checking. | |
constexpr const_reference | value () const & |
Gets const reference to the value with null checking. | |
constexpr rvalue_reference | value () && |
Gets rvalue reference to the value with null checking. | |
constexpr const_rvalue_reference | value () const && |
Gets const rvalue reference to the value with null checking. | |
template<class U> | |
constexpr value_type | value_or (U &&default_value) const & |
Gets the value or a default if null (const version). | |
template<class U> | |
constexpr value_type | value_or (U &&default_value) && |
Gets the value or a default if null (rvalue version). | |
void | swap (self_type &other) noexcept |
Swaps this nullable with another. | |
void | reset () noexcept |
Resets the nullable to null state. | |
template<class U> | |
constexpr auto | value_or (U &&default_value) const &-> value_type |
template<class U> | |
constexpr auto | value_or (U &&default_value) &&-> value_type |
Public Attributes | |
BO & | rhs: m_value(rhs.get()) |
BO && | rhs: m_value(std::move(rhs).get()) |
Friends | |
template<class TO, mpl::boolean_like BO> | |
class | nullable |
Definition at line 289 of file nullable.hpp.
using sparrow::nullable< T, B >::const_reference = typename value_traits::const_reference |
Definition at line 298 of file nullable.hpp.
using sparrow::nullable< T, B >::const_rvalue_reference = typename value_traits::const_rvalue_reference |
Definition at line 300 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_const_reference = typename flag_traits::const_reference |
Definition at line 304 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_const_rvalue_reference = typename flag_traits::const_rvalue_reference |
Definition at line 306 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_reference = typename flag_traits::reference |
Definition at line 303 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_rvalue_reference = typename flag_traits::rvalue_reference |
Definition at line 305 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_traits = nullable_traits<B> |
Definition at line 301 of file nullable.hpp.
using sparrow::nullable< T, B >::flag_type = typename flag_traits::value_type |
Definition at line 302 of file nullable.hpp.
using sparrow::nullable< T, B >::reference = typename value_traits::reference |
Definition at line 297 of file nullable.hpp.
using sparrow::nullable< T, B >::rvalue_reference = typename value_traits::rvalue_reference |
Definition at line 299 of file nullable.hpp.
using sparrow::nullable< T, B >::self_type = nullable<T, B> |
Definition at line 294 of file nullable.hpp.
using sparrow::nullable< T, B >::stored_value_type = T |
Definition at line 293 of file nullable.hpp.
using sparrow::nullable< T, B >::value_traits = nullable_traits<T> |
Definition at line 295 of file nullable.hpp.
using sparrow::nullable< T, B >::value_type = typename value_traits::value_type |
Definition at line 296 of file nullable.hpp.
|
inlineconstexprnoexcept |
Default constructor creating a null nullable.
U | Value type (deduced, must be default constructible) |
BB | Flag type (deduced, must be default constructible) |
Definition at line 320 of file nullable.hpp.
|
inlineconstexprnoexcept |
Constructor from nullval_t creating a null nullable.
U | Value type (deduced, must be default constructible) |
BB | Flag type (deduced, must be default constructible) |
Definition at line 338 of file nullable.hpp.
|
constexprdefault |
Default copy constructor.
rhs | Source nullable to copy from |
|
constexprdefaultnoexcept |
Default move constructor.
rhs | Source nullable to move from |
|
inlineconstexpr |
Constructor from value and flag.
value | Value to move and store |
null_flag | Flag to move and store |
Definition at line 516 of file nullable.hpp.
|
inlineconstexpr |
Constructor from lvalue references (for reference semantics).
value | Reference to value to store |
null_flag | Reference to flag to store |
Definition at line 532 of file nullable.hpp.
|
inlineconstexpr |
Constructor from moved value and flag reference.
value | Value to move and store |
null_flag | Reference to flag to store |
Definition at line 547 of file nullable.hpp.
|
inlineconstexpr |
Constructor from value reference and moved flag.
value | Reference to value to store |
null_flag | Flag to move and store |
Definition at line 562 of file nullable.hpp.
sparrow::nullable< T, B >::explicit | ( | not impl::both_convertible_from_cond_ref< T, TO, B, BO > | ) |
Converting move constructor from different nullable types.
TO | Source value type |
BO | Source flag type |
rhs | Source nullable to move from |
sparrow::nullable< T, B >::explicit | ( | not impl::both_convertible_from_cref< T, TO, B, BO > | ) | const |
Converting copy constructor from different nullable types.
TO | Source value type |
BO | Source flag type |
rhs | Source nullable to copy from |
|
inlinenoexcept |
Constructor from a value creating a non-null nullable.
U | Type of the input value (must be constructible to T) |
value | Value to store |
Definition at line 358 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets rvalue reference to the stored value.
Definition at line 1224 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets mutable reference to the stored value.
Definition at line 1212 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets const rvalue reference to the stored value.
Definition at line 1237 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets const reference to the stored value.
Definition at line 1218 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Checks whether the nullable contains a valid value.
Definition at line 1168 of file nullable.hpp.
|
inline |
Definition at line 399 of file nullable.hpp.
|
inline |
Definition at line 468 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets rvalue reference to the validity flag.
Definition at line 1186 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets mutable reference to the validity flag.
Definition at line 1174 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets const rvalue reference to the validity flag.
Definition at line 1199 of file nullable.hpp.
|
nodiscardconstexprnoexcept |
Gets const reference to the validity flag.
Definition at line 1180 of file nullable.hpp.
|
explicitconstexprnoexcept |
Conversion to bool indicating non-null state.
Definition at line 1162 of file nullable.hpp.
|
inlineconstexprnoexcept |
Converting assignment operator from different nullable types.
TO | Source value type |
BO | Source flag type |
rhs | Source nullable to copy from |
Definition at line 645 of file nullable.hpp.
|
inlineconstexprnoexcept |
Default copy assignment operator.
rhs | Source nullable to copy from |
Definition at line 617 of file nullable.hpp.
|
inlineconstexprnoexcept |
Converting move assignment operator from different nullable types.
TO | Source value type |
BO | Source flag type |
rhs | Source nullable to move from |
Definition at line 691 of file nullable.hpp.
|
inlineconstexprnoexcept |
Assignment from nullval_t, setting nullable to null state.
nullval_t | nullval sentinel value |
Definition at line 578 of file nullable.hpp.
|
inlineconstexprnoexcept |
Default move assignment operator.
rhs | Source nullable to move from |
Definition at line 663 of file nullable.hpp.
|
inlineconstexprnoexcept |
Assignment from a value, setting nullable to non-null state.
TO | Type of the assigned value |
rhs | Value to assign |
Definition at line 599 of file nullable.hpp.
|
noexcept |
Resets the nullable to null state.
Definition at line 1300 of file nullable.hpp.
|
noexcept |
Swaps this nullable with another.
other | Nullable to swap with |
Definition at line 1292 of file nullable.hpp.
|
nodiscardconstexpr |
Gets mutable reference to the value with null checking.
bad_nullable_access | if has_value() is false |
Definition at line 1250 of file nullable.hpp.
|
nodiscardconstexpr |
Gets rvalue reference to the value with null checking.
bad_nullable_access | if has_value() is false |
Definition at line 1264 of file nullable.hpp.
|
nodiscardconstexpr |
Gets const reference to the value with null checking.
bad_nullable_access | if has_value() is false |
Definition at line 1257 of file nullable.hpp.
|
nodiscardconstexpr |
Gets const rvalue reference to the value with null checking.
bad_nullable_access | if has_value() is false |
Definition at line 1271 of file nullable.hpp.
|
nodiscardconstexpr |
Gets the value or a default if null (rvalue version).
U | Type of the default value |
default_value | Value to return if nullable is null |
|
constexpr |
Definition at line 1286 of file nullable.hpp.
|
nodiscardconstexpr |
Gets the value or a default if null (const version).
U | Type of the default value |
default_value | Value to return if nullable is null |
|
constexpr |
Definition at line 1279 of file nullable.hpp.
|
friend |
Definition at line 907 of file nullable.hpp.
BO& sparrow::nullable< T, B >::rhs |
Definition at line 396 of file nullable.hpp.
BO&& sparrow::nullable< T, B >::rhs |
Definition at line 465 of file nullable.hpp.