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
using | std::__detail::__variant::__index_type
template<typename _Visitor, typename... _Variants>
using | std::__detail::__variant::__visit_result_t
template<typename... _Types>
using | std::__detail::__variant::_Copy_assign_alias
template<typename... _Types>
using | std::__detail::__variant::_Copy_ctor_alias
template<typename _Tp, typename _Variant>
using | std::__detail::__variant::_FUN_type
template<typename... _Types>
using | std::__detail::__variant::_Move_assign_alias
template<typename... _Types>
using | std::__detail::__variant::_Move_ctor_alias
template<typename... _Types>
using | std::__detail::__variant::_Variant_storage_alias
template<size_t _Np, typename _Variant>
using | std::variant_alternative_t

## 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 _Union>
constexpr decltype(auto) | std::__detail::__variant::__construct_n (_Union &__u) noexcept
template<typename _Result_type, typename _Visitor, typename... _Variants>
constexpr decltype(auto) | std::__do_visit (_Visitor &&__visitor, _Variants &&... __variants)
template<size_t _Np, bool _Triv, typename... _Types, typename... _Args>
constexpr void | std::__detail::__variant::__emplace (_Variant_storage< _Triv, _Types... > &__v, _Args &&... __args)
template<size_t _Np, typename _Variant>
constexpr decltype(auto) | std::__detail::__variant::__get (_Variant &&__v) noexcept
template<size_t _Np, typename _Union>
constexpr decltype(auto) | std::__detail::__variant::__get_n (_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>
constexpr decltype(auto) | std::__variant_cast (_Tp &&__rhs)
template<size_t _Np, typename... _Types>
constexpr variant_alternative_t< _Np, variant< _Types... > > const && | std::get (const variant< _Types... > &&)
template<size_t _Np, typename... _Types>
constexpr const variant_alternative_t< _Np, variant< _Types... > > && | std::get (const variant< _Types... > &&__v)
template<typename _Tp, typename... _Types>
constexpr const _Tp && | 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<size_t _Np, typename... _Types>
constexpr const variant_alternative_t< _Np, variant< _Types... > > & | std::get (const variant< _Types... > &__v)
template<typename _Tp, typename... _Types>
constexpr const _Tp & | 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<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< const variant_alternative_t< _Np, variant< _Types... > > > | std::get_if (const variant< _Types... > *__ptr) noexcept
template<typename _Tp, typename... _Types>
constexpr add_pointer_t< _Tp > | std::get_if (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 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>
constexpr 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 _Res, typename _Visitor, typename... _Variants>
constexpr _Res | std::visit (_Visitor &&__visitor, _Variants &&... __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 bool | std::__detail::__variant::__same_types
__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
template<typename... _Types>
constexpr size_t | std::variant_size_v< const variant< _Types... > >
template<typename... _Types>
constexpr size_t | std::variant_size_v< variant< _Types... > >

## 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 56 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 1238 of file variant.

## _VARIANT_RELATION_FUNCTION_TEMPLATE [2/2]

#define _VARIANT_RELATION_FUNCTION_TEMPLATE | ( |  | __OP,
|  |  | __NAME )

Definition at line 1238 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

Definition at line 1115 of file variant.

## __index_type

using std::__detail::__variant::__index_type

Definition at line 518 of file variant.

## __visit_result_t

template<typename _Visitor, typename... _Variants>

using std::__detail::__variant::__visit_result_t

Definition at line 1119 of file variant.

## _Copy_assign_alias

template<typename... _Types>

using std::__detail::__variant::_Copy_assign_alias

Definition at line 705 of file variant.

## _Copy_ctor_alias

template<typename... _Types>

using std::__detail::__variant::_Copy_ctor_alias

Definition at line 615 of file variant.

## _FUN_type

template<typename _Tp, typename _Variant>

using std::__detail::__variant::_FUN_type

Definition at line 822 of file variant.

## _Move_assign_alias

template<typename... _Types>

using std::__detail::__variant::_Move_assign_alias

Definition at line 759 of file variant.

## _Move_ctor_alias

template<typename... _Types>

using std::__detail::__variant::_Move_ctor_alias

Definition at line 653 of file variant.

## _Variant_storage_alias

template<typename... _Types>

using std::__detail::__variant::_Variant_storage_alias

Definition at line 575 of file variant.

## Function Documentation

## __as() [1/4]

template<typename... _Types>

const std::variant< _Types... > && std::__detail::__variant::__as | ( | const std::variant< _Types... > && | __v | ) |

constexpr noexcept

Definition at line 207 of file variant.

## __as() [2/4]

template<typename... _Types>

const std::variant< _Types... > & std::__detail::__variant::__as | ( | const std::variant< _Types... > & | __v | ) |

constexpr noexcept

Definition at line 197 of file variant.

## __as() [3/4]

template<typename... _Types>

std::variant< _Types... > && std::__detail::__variant::__as | ( | std::variant< _Types... > && | __v | ) |

constexpr noexcept

Definition at line 202 of file variant.

## __as() [4/4]

template<typename... _Types>

std::variant< _Types... > & std::__detail::__variant::__as | ( | std::variant< _Types... > & | __v | ) |

constexpr noexcept

Definition at line 192 of file variant.

## __check_visitor_results()

template<typename _Visitor, typename _Variant, size_t... _Idxs>

bool std::__detail::__variant::__check_visitor_results | ( | std::index_sequence< _Idxs... > |  | ) |

constexpr

Definition at line 1125 of file variant.

## __construct_n()

template<size_t _Np, typename _Union>

decltype(auto) std::__detail::__variant::__construct_n | ( | _Union & | __u | ) |

constexpr noexcept

Definition at line 327 of file variant.

## __emplace()

template<size_t _Np, bool _Triv, typename... _Types, typename... _Args>

void std::__detail::__variant::__emplace | ( | _Variant_storage< _Triv, _Types... > & | __v,
|  | _Args &&... | __args )

inline constexpr

Definition at line 564 of file variant.

## __get()

template<size_t _Np, typename _Variant>

decltype(auto) std::__detail::__variant::__get | ( | _Variant && | __v | ) |

constexpr noexcept

Definition at line 321 of file variant.

## __get_n()

template<size_t _Np, typename _Union>

decltype(auto) std::__detail::__variant::__get_n | ( | _Union && | __u | ) |

constexpr noexcept

Definition at line 305 of file variant.

## __raw_idx_visit()

template<typename _Visitor, typename... _Variants>

void std::__detail::__variant::__raw_idx_visit | ( | _Visitor && | __visitor,
|  | _Variants &&... | __variants )

constexpr

Definition at line 182 of file variant.

## __raw_visit()

template<typename _Visitor, typename... _Variants>

void std::__detail::__variant::__raw_visit | ( | _Visitor && | __visitor,
|  | _Variants &&... | __variants )

constexpr

Definition at line 173 of file variant.

## Variable Documentation

## __exactly_once

template<typename _Tp, typename... _Types>

bool std::__detail::__variant::__exactly_once

inline constexpr

Definition at line 784 of file variant.

## __same_types

template<typename _Tp, typename... _Types>

bool std::__detail::__variant::__same_types

inline constexpr

Definition at line 1122 of file variant.

## _M_index

__index_type std::__detail::__variant::_M_index

Definition at line 519 of file variant.

## _M_u

template<typename _Tp>

_Variadic_union<_Types...> std::__detail::__variant::_M_u

Definition at line 517 of file variant.