type.newtype


template <typename T>
struct newtype §source

Defines a struct with one field of type T. At runtime a value of newtype is equivalent to a value of type T. Since newtype is a unique type that is not implicitly convertible to/from T, it can be used to improve type safety.

Fields

template <typename T>
inline newtype<T> wrap_newtype(T x) §source

Wrap a value into a newtype

template <typename T>
inline auto unwrap_newtype(newtype<T> x) §source

Unwrap a value of a newtype