plugify  1.0.0.0
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
plg::variant< Ts > Class Template Reference

Public Types

template<std::size_t Idx>
using alternative = std::remove_reference_t< decltype(std::declval< storage & >().template get< Idx >())>
 
using index_type = detail::smallest_suitable_integer_type< sizeof...(Ts)+can_be_valueless, unsigned char, unsigned short, unsigned >
 

Public Member Functions

constexpr variant (const variant &) requires trivial_copy_ctor=default
 
constexpr variant (const variant &o) requires(has_copy_ctor and not trivial_copy_ctor)
 
constexpr variant (variant &&) requires trivial_move_ctor=default
 
constexpr variant (variant &&o) noexcept((std::is_nothrow_move_constructible_v< Ts > &&...)) requires(has_move_ctor and not trivial_move_ctor)
 
template<class T , class M = detail::best_overload_match<T&&, Ts...>, class D = std::decay_t<T>>
constexpr variant (T &&t) noexcept(std::is_nothrow_constructible_v< M, T && >) requires(not std
 
template<std::size_t Index, class... Args>
 requires (Index< size &&std::is_constructible_v< alternative< Index >, Args &&... >) explicit const expr variant(in_place_index_t< Index > tag
 
Args static_cast (args)...}
 
Args _current (Index)
 
template<class T , class... Args>
 requires (detail::appears_exactly_once< T, Ts... > &&std::is_constructible_v< T, Args &&... >) explicit const expr variant(in_place_type_t< T >
 
Args static_cast (args)...}
 
template<std::size_t Index, class U , class... Args>
 requires ((Index< size) and std::is_constructible_v< alternative< Index >, std::initializer_list< U > &, Args &&... >) explicit const expr variant(in_place_index_t< Index > tag
 
std::initializer_list< U > Args static_cast (args)...}
 
constexpr variantoperator= (const variant &o) requires trivial_copy_assign &&trivial_copy_ctor=default
 
constexpr variantoperator= (const variant &rhs) requires(has_copy_assign and not(trivial_copy_assign &&trivial_copy_ctor))
 
constexpr variantoperator= (variant &&o) requires(trivial_move_assign and trivial_move_ctor and trivial_dtor)=default
 
constexpr variantoperator= (variant &&o) noexcept((std::is_nothrow_move_constructible_v< Ts > &&...) &&(std::is_nothrow_move_assignable_v< Ts > &&...)) requires(has_move_assign &&has_move_ctor and not(trivial_move_assign and trivial_move_ctor and trivial_dtor))
 
template<class T >
requires constexpr detail::has_non_ambiguous_match< T, Ts... > variantoperator= (T &&t) noexcept(std::is_nothrow_assignable_v< detail::best_overload_match< T &&, Ts... >, T && > &&std::is_nothrow_constructible_v< detail::best_overload_match< T &&, Ts... >, T && >)
 
template<class T , class... Args>
 requires (std::is_constructible_v< T, Args &&... > &&detail::appears_exactly_once< T, Ts... >) const expr T &emplace(Args &&... args)
 
template<std::size_t Idx, class... Args>
 requires (Idx< size and std::is_constructible_v< alternative< Idx >, Args &&... >) const expr auto &emplace(Args &&... args)
 
template<std::size_t Idx, class U , class... Args>
 requires (Idx< size &&std::is_constructible_v< alternative< Idx >, std::initializer_list< U > &, Args &&... >) const expr auto &emplace(std
 
template<class T , class U , class... Args>
 requires (std::is_constructible_v< T, std::initializer_list< U > &, Args &&... > &&detail::appears_exactly_once< T, Ts... >) const expr T &emplace(std
 
constexpr bool valueless_by_exception () const noexcept
 
constexpr index_type index () const noexcept
 
constexpr void swap (variant &o) noexcept((std::is_nothrow_move_constructible_v< Ts > &&...) &&(detail::swap_trait::template nothrow< Ts > &&...)) requires(has_move_ctor &&(detail
 
template<detail::union_index_t Idx>
constexpr auto & unsafe_get () &noexcept
 
template<detail::union_index_t Idx>
constexpr auto && unsafe_get () &&noexcept
 
template<detail::union_index_t Idx>
constexpr const auto & unsafe_get () const &noexcept
 
template<detail::union_index_t Idx>
constexpr const auto && unsafe_get () const &&noexcept
 

Public Attributes

Args && args: _storage{tag
 
std::initializer_list< U > list
 
std::initializer_list< U > Args && args: _storage{tag
 
std::initializer_list< U > Args list
 
std::initializer_list< U > Args _current
 

Static Public Attributes

static constexpr bool can_be_valueless = not is_trivial
 
static constexpr unsigned size = sizeof...(Ts)
 
static constexpr index_type npos = static_cast<index_type>(-1)
 
template<class T >
static constexpr int index_of = detail::find_first_true({std::is_same_v<T, Ts>...})
 

Friends

template<class T >
struct detail::emplace_no_dtor_from_elem
 

Detailed Description

template<class... Ts>
class plg::variant< Ts >

Definition at line 539 of file variant.hpp.

Member Data Documentation

◆ _current

template<class... Ts>
std::initializer_list< U > Args plg::variant< Ts >::_current
Initial value:
{Index}
{}
template<class T, class U, class... Args>
requires (
detail::appears_exactly_once<T, Ts...>
&& std::is_constructible_v<T, std::initializer_list<U>&, Args&&...>
)
explicit constexpr variant(in_place_type_t<T>, std::initializer_list<U> list, Args&&... args)
: _storage{in_place_index<index_of<T>>, list, static_cast<decltype( args )&&>( args )...}

Definition at line 633 of file variant.hpp.


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