#include <src/vt/utils/strong/strong_type.h>
template<typename T, T init_val, typename Tag>
Strong struct
Used to hoist weak C++ types (like vt::
) into strongly typed values that have a unique type to enforce interfaces, inhibit dangerous conversions, and provide more semantic control.
Derived classes
- struct vt::epoch::EpochType
Public types
- using Type = T
- using ThisType = Strong<T, init_val, Tag>
- using isByteCopyable = std::true_type
Constructors, destructors, conversion operators
Public functions
- auto operator==(ThisType const& in) const -> bool
- Equal operator.
- auto operator!=(ThisType const& in) const -> bool
- Non-equal operator.
- auto operator<(ThisType const& in) const -> bool
- Less-than operator.
- auto operator<=(ThisType const& in) const -> bool
- Less-than-equal operator.
- auto operator>(ThisType const& in) const -> bool
- Greater-than operator.
- auto operator>=(ThisType const& in) const -> bool
- Greater-than-equal operator.
- auto operator*() -> T&
- Dereference the value as a reference.
- auto operator*() const -> T const &
- Dereference the value as a const reference.
- auto get() -> T&
- Get reference.
- auto get() const -> T const &
- Get const reference.
Typedef documentation
template<typename T, T init_val, typename Tag>
using vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: isByteCopyable = std::true_type
All Strong
types are byte-copyable and arithmetic and thus don't need a serializer
Function documentation
template<typename T, T init_val, typename Tag>
vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: Strong(T v) explicit constexpr
Construct with a explicit initial value.
Parameters | |
---|---|
v in | the value |
template<typename T, T init_val, typename Tag>
bool vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator==(ThisType const& in) const
Equal operator.
Parameters | |
---|---|
in in | the other value |
template<typename T, T init_val, typename Tag>
bool vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator!=(ThisType const& in) const
Non-equal operator.
Parameters | |
---|---|
in in | the other value |
template<typename T, T init_val, typename Tag>
bool vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator<=(ThisType const& in) const
Less-than-equal operator.
Parameters | |
---|---|
in in | the other value |
template<typename T, T init_val, typename Tag>
bool vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator>=(ThisType const& in) const
Greater-than-equal operator.
Parameters | |
---|---|
in in | the other value |
template<typename T, T init_val, typename Tag>
T& vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator*()
Dereference the value as a reference.
Returns | reference to underlying value |
---|
template<typename T, T init_val, typename Tag>
T const & vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: operator*() const
Dereference the value as a const reference.
Returns | const reference to the underlying value |
---|
template<typename T, T init_val, typename Tag>
T& vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: get()
Get reference.
Returns | reference to underlying value |
---|
template<typename T, T init_val, typename Tag>
T const & vt:: util:: strong:: detail:: Strong<T, init_val, Tag>:: get() const
Get const reference.
Returns | const reference to underlying value |
---|