libstdc++
variant File Reference

Go to the source code of this file.

Namespaces

namespace  std
 
namespace  std::__detail
 

Macros

#define __cpp_lib_variant
 
#define _GLIBCXX_VARIANT
 
#define _VARIANT_RELATION_FUNCTION_TEMPLATE(__OP)
 
#define _VARIANT_RELATION_FUNCTION_TEMPLATE(__OP, __NAME)
 

Typedefs

template<size_t _Np, typename _Variant , typename _AsV = decltype(__variant::__as(std::declval<_Variant>())), typename _Tp = variant_alternative_t<_Np, remove_reference_t<_AsV>>>
using std::__detail::__variant::__get_t = conditional_t< is_lvalue_reference_v< _Variant >, _Tp &, _Tp && >
 
using std::__detail::__variant::__index_type = __select_index< _Types... >
 
template<typename _Visitor , typename... _Variants>
using std::__detail::__variant::__visit_result_t = invoke_result_t< _Visitor, __get_t< 0, _Variants >... >
 
template<typename... _Types>
using std::__detail::__variant::_Copy_assign_alias = _Copy_assign_base< _Traits< _Types... >::_S_trivial_copy_assign, _Types... >
 
template<typename... _Types>
using std::__detail::__variant::_Copy_ctor_alias = _Copy_ctor_base< _Traits< _Types... >::_S_trivial_copy_ctor, _Types... >
 
template<typename _Tp , typename _Variant >
using std::__detail::__variant::_FUN_type = decltype(_Build_FUNs< _Tp, _Variant >::_S_fun(std::declval< _Tp >()))
 
template<typename... _Types>
using std::__detail::__variant::_Move_assign_alias = _Move_assign_base< _Traits< _Types... >::_S_trivial_move_assign, _Types... >
 
template<typename... _Types>
using std::__detail::__variant::_Move_ctor_alias = _Move_ctor_base< _Traits< _Types... >::_S_trivial_move_ctor, _Types... >
 
template<typename... _Types>
using std::__detail::__variant::_Variant_storage_alias = _Variant_storage< _Traits< _Types... >::_S_trivial_dtor, _Types... >
 
template<size_t _Np, typename _Variant >
using std::variant_alternative_t = typename variant_alternative< _Np, _Variant >::type
 

Functions

template<typename... _Types>
constexpr const std::variant< _Types... > && std::__detail::__variant::__as (const std::variant< _Types... > &&__v) noexcept
 
template<typename... _Types>
constexpr const std::variant< _Types... > & std::__detail::__variant::__as (const std::variant< _Types... > &__v) noexcept
 
template<typename... _Types>
constexpr std::variant< _Types... > && std::__detail::__variant::__as (std::variant< _Types... > &&__v) noexcept
 
template<typename... _Types>
constexpr std::variant< _Types... > & std::__detail::__variant::__as (std::variant< _Types... > &__v) noexcept
 
template<typename _Visitor , typename _Variant , size_t... _Idxs>
constexpr bool std::__detail::__variant::__check_visitor_results (std::index_sequence< _Idxs... >)
 
template<size_t _Np, typename _Variant , typename... _Args>
void std::__detail::__variant::__construct_by_index (_Variant &__v, _Args &&... __args)
 
template<typename _Result_type , typename _Visitor , typename... _Variants>
constexpr decltype(auto) std::__do_visit (_Visitor &&__visitor, _Variants &&... __variants)
 
template<size_t _Np, typename _Variant >
constexpr decltype(auto) std::__detail::__variant::__get (_Variant &&__v) noexcept
 
template<typename _Union >
constexpr decltype(auto) std::__detail::__variant::__get (in_place_index_t< 0 >, _Union &&__u) noexcept
 
template<size_t _Np, typename _Union >
constexpr decltype(auto) std::__detail::__variant::__get (in_place_index_t< _Np >, _Union &&__u) noexcept
 
template<typename _Visitor , typename... _Variants>
constexpr void std::__detail::__variant::__raw_idx_visit (_Visitor &&__visitor, _Variants &&... __variants)
 
template<typename _Visitor , typename... _Variants>
constexpr void std::__detail::__variant::__raw_visit (_Visitor &&__visitor, _Variants &&... __variants)
 
void std::__throw_bad_variant_access (bool __valueless)
 
void std::__throw_bad_variant_access (const char *__what)
 
template<typename... _Types, typename _Tp >
decltype(auto) std::__variant_cast (_Tp &&__rhs)
 
template<typename... _Types, typename _Tp , typename _Up >
void std::__detail::__variant::__variant_construct (_Tp &&__lhs, _Up &&__rhs)
 
template<typename _Tp , typename _Up >
void std::__detail::__variant::__variant_construct_single (_Tp &&__lhs, _Up &&__rhs_mem)
 
template<size_t _Np, typename... _Types>
constexpr variant_alternative_t< _Np, variant< _Types... > > const && std::get (const variant< _Types... > &&)
 
template<typename _Tp , typename... _Types>
constexpr const _Tp && std::get (const variant< _Types... > &&__v)
 
template<size_t _Np, typename... _Types>
constexpr const variant_alternative_t< _Np, variant< _Types... > > && std::get (const variant< _Types... > &&__v)
 
template<size_t _Np, typename... _Types>
constexpr variant_alternative_t< _Np, variant< _Types... > > const & std::get (const variant< _Types... > &)
 
template<typename _Tp , typename... _Types>
constexpr const _Tp & std::get (const variant< _Types... > &__v)
 
template<size_t _Np, typename... _Types>
constexpr const variant_alternative_t< _Np, variant< _Types... > > & std::get (const variant< _Types... > &__v)
 
template<size_t _Np, typename... _Types>
constexpr variant_alternative_t< _Np, variant< _Types... > > && std::get (variant< _Types... > &&)
 
template<typename _Tp , typename... _Types>
constexpr _Tp && std::get (variant< _Types... > &&__v)
 
template<size_t _Np, typename... _Types>
constexpr variant_alternative_t< _Np, variant< _Types... > > & std::get (variant< _Types... > &)
 
template<typename _Tp , typename... _Types>
constexpr _Tp & std::get (variant< _Types... > &__v)
 
template<size_t _Np, typename... _Types>
constexpr add_pointer_t< const variant_alternative_t< _Np, variant< _Types... > > > std::get_if (const variant< _Types... > *__ptr) noexcept
 
template<typename _Tp , typename... _Types>
constexpr add_pointer_t< const _Tp > std::get_if (const variant< _Types... > *__ptr) noexcept
 
template<size_t _Np, typename... _Types>
constexpr add_pointer_t< variant_alternative_t< _Np, variant< _Types... > > > std::get_if (variant< _Types... > *__ptr) noexcept
 
template<typename _Tp , typename... _Types>
constexpr add_pointer_t< _Tp > std::get_if (variant< _Types... > *__ptr) noexcept
 
template<typename _Tp , typename... _Types>
constexpr bool std::holds_alternative (const variant< _Types... > &__v) noexcept
 
template<typename... _Types>
constexpr bool std::operator!= (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator!= (monostate, monostate) noexcept
 
template<typename... _Types>
constexpr bool std::operator< (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator< (monostate, monostate) noexcept
 
template<typename... _Types>
constexpr bool std::operator<= (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator<= (monostate, monostate) noexcept
 
template<typename... _Types>
constexpr bool std::operator== (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator== (monostate, monostate) noexcept
 
template<typename... _Types>
constexpr bool std::operator> (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator> (monostate, monostate) noexcept
 
template<typename... _Types>
constexpr bool std::operator>= (const variant< _Types... > &__lhs, const variant< _Types... > &__rhs)
 
constexpr bool std::operator>= (monostate, monostate) noexcept
 
template<typename... _Types>
enable_if_t<!((is_move_constructible_v< _Types > &&...) &&(is_swappable_v< _Types > &&...))> std::swap (variant< _Types... > &, variant< _Types... > &)=delete
 
template<typename... _Types>
enable_if_t<(is_move_constructible_v< _Types > &&...) &&(is_swappable_v< _Types > &&...)> std::swap (variant< _Types... > &__lhs, variant< _Types... > &__rhs) noexcept(noexcept(__lhs.swap(__rhs)))
 
template<typename _Visitor , typename... _Variants>
constexpr __detail::__variant::__visit_result_t< _Visitor, _Variants... > std::visit (_Visitor &&, _Variants &&...)
 
template<typename _Visitor , typename... _Variants>
constexpr __detail::__variant::__visit_result_t< _Visitor, _Variants... > std::visit (_Visitor &&__visitor, _Variants &&... __variants)
 

Variables

template<typename _Tp , typename... _Types>
constexpr bool std::__detail::__variant::__exactly_once
 
template<typename _Tp , typename... _Types>
constexpr size_t std::__detail::__variant::__index_of_v
 
template<typename _Tp , typename... _Types>
constexpr bool std::__detail::__variant::__same_types
 
template<typename _Tp , typename _Tuple >
constexpr size_t std::__detail::__variant::__tuple_count_v
 
__index_type std::__detail::__variant::_M_index
 
template<typename _Tp >
_Variadic_union< _Types... > std::__detail::__variant::_M_u
 
constexpr size_t std::variant_npos
 
template<typename _Variant >
constexpr size_t std::variant_size_v
 

Detailed Description

This is the <variant> C++ Library header.

Definition in file variant.

Macro Definition Documentation

◆ __cpp_lib_variant

#define __cpp_lib_variant

Definition at line 74 of file variant.

◆ _GLIBCXX_VARIANT

#define _GLIBCXX_VARIANT

Definition at line 30 of file variant.

◆ _VARIANT_RELATION_FUNCTION_TEMPLATE [1/2]

#define _VARIANT_RELATION_FUNCTION_TEMPLATE (   __OP)

Definition at line 1205 of file variant.

◆ _VARIANT_RELATION_FUNCTION_TEMPLATE [2/2]

#define _VARIANT_RELATION_FUNCTION_TEMPLATE (   __OP,
  __NAME 
)

Definition at line 1205 of file variant.

Typedef Documentation

◆ __get_t

template<size_t _Np, typename _Variant , typename _AsV = decltype(__variant::__as(std::declval<_Variant>())), typename _Tp = variant_alternative_t<_Np, remove_reference_t<_AsV>>>
using std::__detail::__variant::__get_t = typedef conditional_t<is_lvalue_reference_v<_Variant>, _Tp&, _Tp&&>

Definition at line 1073 of file variant.

◆ __index_type

using std::__detail::__variant::__index_type = typedef __select_index<_Types...>

Definition at line 447 of file variant.

◆ __visit_result_t

template<typename _Visitor , typename... _Variants>
using std::__detail::__variant::__visit_result_t = typedef invoke_result_t<_Visitor, __get_t<0, _Variants>...>

Definition at line 1078 of file variant.

◆ _Copy_assign_alias

template<typename... _Types>
using std::__detail::__variant::_Copy_assign_alias = typedef _Copy_assign_base<_Traits<_Types...>::_S_trivial_copy_assign, _Types...>

Definition at line 653 of file variant.

◆ _Copy_ctor_alias

template<typename... _Types>
using std::__detail::__variant::_Copy_ctor_alias = typedef _Copy_ctor_base<_Traits<_Types...>::_S_trivial_copy_ctor, _Types...>

Definition at line 535 of file variant.

◆ _FUN_type

template<typename _Tp , typename _Variant >
using std::__detail::__variant::_FUN_type = typedef decltype(_Build_FUNs<_Tp, _Variant>::_S_fun(std::declval<_Tp>()))

Definition at line 779 of file variant.

◆ _Move_assign_alias

template<typename... _Types>
using std::__detail::__variant::_Move_assign_alias = typedef _Move_assign_base<_Traits<_Types...>::_S_trivial_move_assign, _Types...>

Definition at line 696 of file variant.

◆ _Move_ctor_alias

template<typename... _Types>
using std::__detail::__variant::_Move_ctor_alias = typedef _Move_ctor_base<_Traits<_Types...>::_S_trivial_move_ctor, _Types...>

Definition at line 595 of file variant.

◆ _Variant_storage_alias

template<typename... _Types>
using std::__detail::__variant::_Variant_storage_alias = typedef _Variant_storage<_Traits<_Types...>::_S_trivial_dtor, _Types...>

Definition at line 483 of file variant.

Function Documentation

◆ __as() [1/4]

template<typename... _Types>
constexpr const std::variant< _Types... > && std::__detail::__variant::__as ( const std::variant< _Types... > &&  __v)
constexprnoexcept

Definition at line 224 of file variant.

◆ __as() [2/4]

template<typename... _Types>
constexpr const std::variant< _Types... > & std::__detail::__variant::__as ( const std::variant< _Types... > &  __v)
constexprnoexcept

Definition at line 214 of file variant.

◆ __as() [3/4]

template<typename... _Types>
constexpr std::variant< _Types... > && std::__detail::__variant::__as ( std::variant< _Types... > &&  __v)
constexprnoexcept

Definition at line 219 of file variant.

◆ __as() [4/4]

template<typename... _Types>
constexpr std::variant< _Types... > & std::__detail::__variant::__as ( std::variant< _Types... > &  __v)
constexprnoexcept

Definition at line 209 of file variant.

◆ __check_visitor_results()

template<typename _Visitor , typename _Variant , size_t... _Idxs>
constexpr bool std::__detail::__variant::__check_visitor_results ( std::index_sequence< _Idxs... >  )
constexpr

Definition at line 1085 of file variant.

◆ __construct_by_index()

template<size_t _Np, typename _Variant , typename... _Args>
void std::__detail::__variant::__construct_by_index ( _Variant &  __v,
_Args &&...  __args 
)
inline

Definition at line 1094 of file variant.

◆ __get() [1/3]

template<size_t _Np, typename _Variant >
constexpr decltype(auto) std::__detail::__variant::__get ( _Variant &&  __v)
constexprnoexcept

Definition at line 298 of file variant.

◆ __get() [2/3]

template<typename _Union >
constexpr decltype(auto) std::__detail::__variant::__get ( in_place_index_t< 0 >  ,
_Union &&  __u 
)
constexprnoexcept

Definition at line 284 of file variant.

◆ __get() [3/3]

template<size_t _Np, typename _Union >
constexpr decltype(auto) std::__detail::__variant::__get ( in_place_index_t< _Np >  ,
_Union &&  __u 
)
constexprnoexcept

Definition at line 289 of file variant.

◆ __raw_idx_visit()

template<typename _Visitor , typename... _Variants>
constexpr void std::__detail::__variant::__raw_idx_visit ( _Visitor &&  __visitor,
_Variants &&...  __variants 
)
constexpr

Definition at line 199 of file variant.

◆ __raw_visit()

template<typename _Visitor , typename... _Variants>
constexpr void std::__detail::__variant::__raw_visit ( _Visitor &&  __visitor,
_Variants &&...  __variants 
)
constexpr

Definition at line 190 of file variant.

◆ __variant_construct()

template<typename... _Types, typename _Tp , typename _Up >
void std::__detail::__variant::__variant_construct ( _Tp &&  __lhs,
_Up &&  __rhs 
)

Definition at line 497 of file variant.

◆ __variant_construct_single()

template<typename _Tp , typename _Up >
void std::__detail::__variant::__variant_construct_single ( _Tp &&  __lhs,
_Up &&  __rhs_mem 
)

Definition at line 487 of file variant.

Variable Documentation

◆ __exactly_once

template<typename _Tp , typename... _Types>
constexpr bool std::__detail::__variant::__exactly_once
inlineconstexpr

Definition at line 741 of file variant.

◆ __index_of_v

template<typename _Tp , typename... _Types>
constexpr size_t std::__detail::__variant::__index_of_v
inlineconstexpr

Definition at line 173 of file variant.

◆ __same_types

template<typename _Tp , typename... _Types>
constexpr bool std::__detail::__variant::__same_types
inlineconstexpr

Definition at line 1082 of file variant.

◆ __tuple_count_v

template<typename _Tp , typename _Tuple >
constexpr size_t std::__detail::__variant::__tuple_count_v
inlineconstexpr

Definition at line 726 of file variant.

◆ _M_index

__index_type std::__detail::__variant::_M_index

Definition at line 448 of file variant.

◆ _M_u

template<typename _Tp >
_Variadic_union<_Types...> std::__detail::__variant::_M_u

Definition at line 446 of file variant.