OGS
|
A "strong" version of the underlying type T.
Strong types with same T but different tag are not implicitly convertible to each other, and are not implicitly convertible to/from T. Based on these properties strong types can serve as an ingredient for safer APIs.
Definition at line 24 of file StrongType.h.
#include <StrongType.h>
Public Member Functions | |
constexpr | StrongType () noexcept(std::is_nothrow_default_constructible_v< T >) |
constexpr | StrongType (T const &value) noexcept(std::is_nothrow_copy_constructible_v< T >) |
constexpr | StrongType (T &&value) noexcept(std::is_nothrow_move_constructible_v< T >) |
constexpr T & | operator() () noexcept |
constexpr T const & | operator() () const noexcept |
constexpr T & | operator* () noexcept |
constexpr T const & | operator* () const noexcept |
constexpr T * | operator-> () noexcept |
Value access. | |
constexpr T const * | operator-> () const noexcept |
Private Attributes | |
T | value_ |
|
inlineconstexprnoexcept |
Definition at line 47 of file StrongType.h.
|
inlineexplicitconstexprnoexcept |
Definition at line 52 of file StrongType.h.
|
inlineexplicitconstexprnoexcept |
Definition at line 58 of file StrongType.h.
|
inlinenodiscardconstexprnoexcept |
Definition at line 67 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
inlinenodiscardconstexprnoexcept |
Value access. Alternative to operator*, operator() might look clearer in mathematical expressions.
Definition at line 66 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
inlinenodiscardconstexprnoexcept |
Definition at line 75 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
inlinenodiscardconstexprnoexcept |
Value access. Alternative to operator(). Introduced for symmetry reasons as a companion to operator->.
Definition at line 74 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
inlinenodiscardconstexprnoexcept |
Definition at line 82 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
inlinenodiscardconstexprnoexcept |
Value access.
Definition at line 81 of file StrongType.h.
References BaseLib::StrongType< T, Tag >::value_.
|
private |
Definition at line 88 of file StrongType.h.
Referenced by BaseLib::StrongType< T, Tag >::operator()(), BaseLib::StrongType< T, Tag >::operator()(), BaseLib::StrongType< T, Tag >::operator*(), BaseLib::StrongType< T, Tag >::operator*(), BaseLib::StrongType< T, Tag >::operator->(), and BaseLib::StrongType< T, Tag >::operator->().