mrdocs::sentinel_traits

Defines a customization point for types that have an intrinsic sentinel value denoting “null”.

Synopsis

Declared in <mrdocs/ADT/Nullable.hpp>

template<class T>
struct sentinel_traits;

Description

Users may specialize this trait for their own types to declare a sentinel‐based null representation.

When enabled, nullable semantics can be implemented in terms of the sentinel without storing a separate engaged/disengaged flag.

Contract for specializations: ‐ Provide static constexpr T sentinel() noexcept; which returns the distinguished null value. ‐ Provide static constexpr bool is_sentinel(const T&) noexcept; which recognizes the null value.

If a type does not have a well‐defined sentinel, leave the primary template in effect.

Notes ‐ Built‐in pointer types and std::nullptr_t are pre‐specialized to use nullptr as the sentinel.

Created with MrDocs