vari
Loading...
Searching...
No Matches
vari::_uvref< Deleter, Ts > Class Template Reference

A non-nullable owning pointer to one of the types in Ts... More...

#include <uvref.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 _uvref (_uvref< Deleter2, Us... > &&p) noexcept
 Constructs an uvref by transfering ownership from uvref with compatible types.
 
template<typename U >
requires ( vconvertible_type< U, types > )
constexpr _uvref (U &u) noexcept
 Constructs an uvref which owns a reference to one of the types that uvref can reference.
 
template<typename U >
requires ( vconvertible_type< U, types > && move_constructible_deleter< Deleter > )
constexpr _uvref (U &u, Deleter &&d) noexcept
 Constructs an uvref which owns a reference to one of the types that uvref can reference. More...
 
template<typename U >
requires ( vconvertible_type< U, types > && copy_constructible_deleter< Deleter > )
constexpr _uvref (U &u, Deleter const &d) noexcept
 Constructs an uvref which owns a reference to one of the types that uvref can reference. More...
 
constexpr reference get () const noexcept
 Returns a reference 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 referenced. More...
 
template<typename... Us>
constexpr operator _vref< Us... > () &&=delete
 Conversion operator from rvalue reference to vref is forbidden.
 
template<typename... Us>
requires ( vconvertible_to< types, typelist< Us... > > )
constexpr operator _vref< Us... > () &noexcept
 Conversion operator from lvalue reference to types-compatible vref
 
template<typename... Us>
requires ( vconvertible_to< types, typelist< Us... > > )
constexpr operator _vref< Us... > () const &noexcept
 Conversion operator from lvalue const reference to types-compatible vref
 
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 _uvrefoperator= (_uvref< Deleter2, Us... > &&p) noexcept
 Move assignment operator transfering ownership from uvref with compatible types. 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.
 
constexpr owning_pointer vptr () &&noexcept
 Constructs an owning variadic pointer and transfers ownership of current target to the pointer.
 
constexpr pointer vptr () const &noexcept
 Constructs a variadic pointer that points to the same target as the current reference.
 
constexpr ~_uvref ()
 Destroys the owned object.
 

Friends

constexpr void swap (_uvref &lh, _uvref &rh) noexcept
 Swaps uvref with each other.
 

Detailed Description

template<typename Deleter, typename... Ts>
class vari::_uvref< Deleter, Ts >

A non-nullable owning pointer to one of the types in Ts...

Constructor & Destructor Documentation

◆ _uvref() [1/2]

template<typename Deleter , typename... Ts>
template<typename U >
requires ( vconvertible_type< U, types > && copy_constructible_deleter< Deleter > )
constexpr vari::_uvref< Deleter, Ts >::_uvref ( U &  u,
Deleter const &  d 
)
inlineexplicitconstexprnoexcept

Constructs an uvref which owns a reference to one of the types that uvref can reference.

Internal Deleter is copy-constructed from d.

◆ _uvref() [2/2]

template<typename Deleter , typename... Ts>
template<typename U >
requires ( vconvertible_type< U, types > && move_constructible_deleter< Deleter > )
constexpr vari::_uvref< Deleter, Ts >::_uvref ( U &  u,
Deleter &&  d 
)
inlineexplicitconstexprnoexcept

Constructs an uvref which owns a reference to one of the types that uvref can reference.

Internal Deleter is move-constructed from d.

Member Function Documentation

◆ index()

template<typename Deleter , typename... Ts>
constexpr index_type vari::_uvref< Deleter, Ts >::index ( ) const
inlineconstexprnoexcept

Returns the index representing the type currently being referenced.

The index of the first type is 0, with subsequent types sequentially numbered.

◆ operator*()

template<typename Deleter , typename... Ts>
constexpr auto & vari::_uvref< Deleter, Ts >::operator* ( ) const
inlineconstexprnoexcept

Dereferences to the pointed-to type.

It is T& if there is only one type in Ts..., or void& otherwise.

◆ operator->()

template<typename Deleter , typename... Ts>
constexpr auto * vari::_uvref< Deleter, Ts >::operator-> ( ) const
inlineconstexprnoexcept

Provides member access to the pointed-to type.

It is T* if there is only one type in Ts..., or void* otherwise.

◆ operator=()

template<typename Deleter , typename... Ts>
template<typename Deleter2 , typename... Us>
requires ( vconvertible_to< typelist< Us... >, types > && convertible_deleter< Deleter2, Deleter > )
constexpr _uvref & vari::_uvref< Deleter, Ts >::operator= ( _uvref< Deleter2, Us... > &&  p)
inlineconstexprnoexcept

Move assignment operator transfering ownership from uvref with compatible types.

Deleter is move-constructed from the other uvref.

◆ take()

template<typename Deleter , typename... Ts>
template<typename... Fs>
constexpr decltype(auto) vari::_uvref< Deleter, Ts >::take ( Fs &&...  fs) &&
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....


The documentation for this class was generated from the following files: