mrdocs::nullable_traits

nullable_traits<T> defines how to treat a T as “nullable” without an external engaged bit.

Synopsis

Declared in <mrdocs/ADT/Nullable.hpp>

template<class T>
struct nullable_traits;

Description

This trait is the canonical place to encode nullability semantics used by any optional-like type.

It exposes the minimal operations needed by an optional:

  • is_null(const T&): test if a value is null.

  • null(): create a null value.

  • make_null(T&): turn an existing value into null.

Users may explicitly specialize nullable_traits for their types to define the desired semantics.

Specializations

NameDescription
nullable_traits<Location> nullable_traits specialization for Location.
nullable_traits<T> nullable_traits for types with a sentinel.
nullable_traits<Polymorphic<T>> nullable_traits for Polymorphic<T>.