vari
|
A nullable pointer to one of the types in Ts... More...
#include <vptr.h>
Public Member Functions | |
template<typename... Us> requires ( vconvertible_to< typelist< Us... >, types > ) | |
constexpr | _vptr (_vptr< Us... > const &p) noexcept |
Copy constructor for any compatible vptr . | |
template<typename... Us> requires ( vconvertible_to< typelist< Us... >, types > ) | |
constexpr | _vptr (_vref< Us... > const &r) noexcept |
Copy constructor for any compatible vref . | |
constexpr | _vptr (std::nullptr_t) noexcept |
Construct a pointer in a null state. | |
template<typename U > requires ( vconvertible_to< typelist< U >, types > ) | |
constexpr | _vptr (U *u) noexcept |
Constructs a vptr from a pointer to one of the types that vptr can reference. More... | |
constexpr auto * | get () const noexcept |
Returns a pointer to the pointed-to type. More... | |
constexpr index_type | index () const noexcept |
Returns the index representing the type currently being pointed-to. More... | |
constexpr | operator bool () const noexcept |
Check if the pointer is not null. | |
constexpr auto & | operator* () const noexcept |
Dereferences to the pointed-to type. More... | |
constexpr auto * | operator-> () const noexcept |
Provides member access to the pointed-to type. More... | |
template<typename... Fs> | |
constexpr decltype(auto) | visit (Fs &&... fs) const |
Calls the appropriate function from the list fs... , based on the type of the current target, or one with empty_t in case of null pointer. | |
constexpr reference | vref () const noexcept |
Constructs a variadic reference that points to the same target as this pointer. More... | |
Friends | |
constexpr void | swap (_vptr &lh, _vptr &rh) noexcept |
Swaps vptr with each other. | |
A nullable pointer to one of the types in Ts...
|
inlineconstexprnoexcept |
Constructs a vptr
from a pointer to one of the types that vptr
can reference.
If pointer is null, vptr
is constructed as if nullptr
was passed.
|
inlineconstexprnoexcept |
Returns a pointer to the pointed-to type.
It is T*
if there is only one type in Ts...
, or void*
otherwise. Can be null.
|
inlineconstexprnoexcept |
Returns the index representing the type currently being pointed-to.
The index of the first type is 0, with subsequent types sequentially numbered. null_index
constant is used in case the pointer is null.
|
inlineconstexprnoexcept |
Dereferences to the pointed-to type.
It is T&
if there is only one type in Ts...
, or void&
otherwise. Undefined behavior on null pointer.
|
inlineconstexprnoexcept |
Provides member access to the pointed-to type.
It is T*
if there is only one type in Ts...
, or void*
otherwise. Undefined behavior on null pointer.
|
inlineconstexprnoexcept |
Constructs a variadic reference that points to the same target as this pointer.
Undefined behavior if the pointer is null.