folly::strong_derefable

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:

Synopsis

Declared in <folly/lang/Strong.h>

template<
    typename T,
    typename Tag>
class strong_derefable
    : public strong<T, Tag>

Description

struct X : strong_derefable<T, X> { /* as above */ };

Base Classes

NameDescription
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.

Type Aliases

NameDescription
underlying_type The wrapped underlying type T.

Member Functions

NameDescription
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.

Using Declarations

Name
Unnamed using

Non-Member Functions

NameDescription
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.