vari
|
A nullable owning pointer to one of the types in Ts... More...
#include <uvptr.h>
Inherits vari::_deleter_box< Deleter >.
Public Member Functions | |
template<typename Deleter2 , typename... Us> requires ( vconvertible_to< typelist< Us... >, types > && convertible_deleter< Deleter2, Deleter > ) | |
constexpr | _uvptr (_uvptr< Deleter2, Us... > &&p) noexcept |
Constructs an uvptr by transfering ownership from uvptr with compatible types. | |
template<typename Deleter2 , typename... Us> requires ( vconvertible_to< typelist< Us... >, types > && convertible_deleter< Deleter2, Deleter > ) | |
constexpr | _uvptr (_uvref< Deleter2, Us... > &&p) noexcept |
Constructs an uvptr by transfering ownership from uvref with compatible types. | |
constexpr | _uvptr (std::nullptr_t) noexcept |
Construct a pointer in a null state. | |
template<typename U > requires ( vconvertible_type< U, types > ) | |
constexpr | _uvptr (U *u) noexcept |
Constructs an uvptr which owns a pointer to one of the types that uvptr can reference. More... | |
template<typename U > requires ( vconvertible_type< U, types > && move_constructible_deleter< Deleter > ) | |
constexpr | _uvptr (U *u, Deleter &&d) noexcept |
Constructs an uvptr which owns a pointer to one of the types that uvptr can reference. More... | |
template<typename U > requires ( vconvertible_type< U, types > && copy_constructible_deleter< Deleter > ) | |
constexpr | _uvptr (U *u, Deleter const &d) noexcept |
Constructs an uvptr which owns a pointer to one of the types that uvptr can reference. More... | |
constexpr pointer | get () const noexcept |
Returns a pointer to the pointed-to type. | |
Deleter const & | get_deleter () const noexcept |
Getter to the internal deleter. | |
Deleter & | get_deleter () noexcept |
Getter to the internal deleter. | |
constexpr index_type | index () const noexcept |
Returns the index representing the type currently being pointed-to. More... | |
template<typename... Us> | |
constexpr | operator _vptr< Us... > () &&=delete |
Conversion operator from rvalue reference to vptr is forbidden. | |
template<typename... Us> requires ( vconvertible_to< types, typelist< Us... > > ) | |
constexpr | operator _vptr< Us... > () &noexcept |
Conversion operator from lvalue reference to types-compatible vptr | |
template<typename... Us> requires ( vconvertible_to< types, typelist< Us... > > ) | |
constexpr | operator _vptr< Us... > () const &noexcept |
Conversion operator from lvalue const reference to types-compatible vptr | |
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 Deleter2 , typename... Us> requires ( vconvertible_to< typelist< Us... >, types > && convertible_deleter< Deleter2, Deleter > ) | |
constexpr _uvptr & | operator= (_uvptr< Deleter2, Us... > &&p) noexcept |
Move assignment operator transfering ownership from uvptr with compatible types. More... | |
constexpr _uvptr & | operator= (std::nullptr_t) noexcept |
nullptr assignment operator resets this pointer. | |
constexpr pointer | release () noexcept |
Release the ownership of managed object, if any. More... | |
template<typename... Fs> | |
constexpr decltype(auto) | take (Fs &&... fs) && |
Constructs an owning reference to currently pointed-to type and transfers ownership to it. More... | |
template<typename... Fs> | |
constexpr decltype(auto) | visit (Fs &&... f) 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 owning_reference | vref () &&noexcept |
Constructs an owning variadic reference and trasnfers ownership of current target to the reference. More... | |
constexpr reference | vref () const &noexcept |
Constructs a variadic reference that points to the same target as this pointer. More... | |
constexpr | ~_uvptr () |
Destroys the owned object, if any. | |
Friends | |
constexpr void | swap (_uvptr &lh, _uvptr &rh) noexcept |
Swaps uvptr with each other. | |
A nullable owning pointer to one of the types in Ts...
|
inlineconstexprnoexcept |
Constructs an uvptr
which owns a pointer to one of the types that uvptr
can reference.
If pointer is null, uvptr
is constructed as if nullptr
was passed.
|
inlineconstexprnoexcept |
Constructs an uvptr
which owns a pointer to one of the types that uvptr
can reference.
If pointer is null, uvptr
is constructed as if nullptr
was passed.
Internal Deleter
is copy-constructed from d
.
|
inlineconstexprnoexcept |
Constructs an uvptr
which owns a pointer to one of the types that uvptr
can reference.
If pointer is null, uvptr
is constructed as if nullptr
was passed.
Internal Deleter
is move-constructed from d
.
|
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 |
Move assignment operator transfering ownership from uvptr
with compatible types.
Deleter
is move-constructed from the other uvptr
.
|
inlineconstexprnoexcept |
Release the ownership of managed object, if any.
Returns pointer
to the managed object, it is reponsibility of caller to clean it up.
|
inlineconstexpr |
Constructs an owning reference to currently pointed-to type and transfers ownership to it.
Moves it to the appropriate function from the list fs...
. In case the this is null calls overload with empty_t
.
|
inlineconstexprnoexcept |
Constructs an owning variadic reference and trasnfers ownership of current target to the reference.
Undefined behavior if the pointer is null.
|
inlineconstexprnoexcept |
Constructs a variadic reference that points to the same target as this pointer.
Undefined behavior if the pointer is null.