strong_derefable<T, Tag> - a strong type with pointer-like dereference operators. Inherits all functionality from strong and adds operator* and operator-> for convenient access to the underlying value. Usage:
Declared in <folly/lang/Strong.h>
template<
typename T,
typename Tag>
class strong_derefable
: public strong<T, Tag>
struct X : strong_derefable<T, X> { /* as above */ };
| Name | Description |
|---|---|
strong<T, Tag> | strong<T, Tag> - prevent accidental mixing of semantically different uses of the same underlying type. Known as "newtype" in some languages. C++20. Default-construction value-initializes T, even if it's a primitive type. |
| Name | Description |
|---|---|
underlying_type | The wrapped underlying type T. |
| Name | Description |
|---|---|
operator* | Dereference operators |
operator-> | Member access operators |
value | value overloads |
operator T& | Explicitly convert to a mutable lvalue reference to the underlying value. |
operator T&& | Explicitly convert to an rvalue reference to the underlying value. |
operator T const& | Explicitly convert to a const lvalue reference to the underlying value. |
operator T const&& | Explicitly convert to a const rvalue reference to the underlying value. |
| Name |
|---|
Unnamed using |
| Name | Description |
|---|---|
operator<=> | Three-way-compare a strong against a value of the underlying type. |
operator<=> | Three-way-compare two strong values; available iff T is comparable. |
operator== | Equality-compare a strong against a value of the underlying type. |
operator== | Equality-compare two strong values; available iff T is comparable. |