#ifndef ABSL_TYPES_INTERNAL_VARIANT_H_
#define ABSL_TYPES_INTERNAL_VARIANT_H_
#include <cassert>
#include <cstddef>
#include <cstdlib>
#include <memory>
#include <stdexcept>
#include <tuple>
#include <type_traits>
#include <utility>
#include "absl/base/config.h"
#include "absl/base/internal/identity.h"
#include "absl/base/internal/inline_variable.h"
#include "absl/base/internal/invoke.h"
#include "absl/base/macros.h"
#include "absl/base/optimization.h"
#include "absl/meta/type_traits.h"
#include "absl/types/bad_variant_access.h"
#include "absl/utility/utility.h"
#if !defined(ABSL_USES_STD_VARIANT)
namespace absl {
ABSL_NAMESPACE_BEGIN
template <class... Types>
class variant;
ABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, static_cast<size_t>(-1));
template <class T>
struct variant_size;
template <std::size_t I, class T>
struct variant_alternative;
namespace variant_internal {
template <std::size_t I, class T>
struct VariantAlternativeSfinae { … };
VariantAlternativeSfinae<I, variant<T0, Tn...>>;
VariantAlternativeSfinae<0, variant<T0, Ts...>>;
VariantAlternativeSfinaeT;
template <class T, class U>
struct GiveQualsTo;
GiveQualsTo<T &, U>;
GiveQualsTo<T &&, U>;
GiveQualsTo<const T &, U>;
GiveQualsTo<const T &&, U>;
GiveQualsTo<volatile T &, U>;
GiveQualsTo<volatile T &&, U>;
GiveQualsTo<const volatile T &, U>;
GiveQualsTo<const volatile T &&, U>;
GiveQualsToT;
SizeT;
NPos;
template <class Variant, class T, class = void>
struct IndexOfConstructedType { … };
template <std::size_t I, class Variant>
struct VariantAccessResultImpl;
VariantAccessResultImpl<I, Variantemplate<T...> &>;
VariantAccessResultImpl<I, const Variantemplate<T...> &>;
VariantAccessResultImpl<I, Variantemplate<T...> &&>;
VariantAccessResultImpl<I, const Variantemplate<T...> &&>;
VariantAccessResult;
template <class T, std::size_t Size>
struct SimpleArray { … };
template <class T>
struct AccessedType { … };
AccessedTypeT;
AccessedType<SimpleArray<T, Size>>;
template <class T>
constexpr T AccessSimpleArray(const T& value) { … }
template <class T, std::size_t Size, class... SizeT>
constexpr AccessedTypeT<T> AccessSimpleArray(const SimpleArray<T, Size>& table,
std::size_t head_index,
SizeT... tail_indices) { … }
AlwaysZero;
template <class Op, class... Vs>
struct VisitIndicesResultImpl { … };
VisitIndicesResultT;
template <class ReturnType, class FunctionObject, class EndIndices,
class BoundIndices>
struct MakeVisitationMatrix;
template <class ReturnType, class FunctionObject, std::size_t... Indices>
constexpr ReturnType call_with_indices(FunctionObject&& function) { … }
MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<>, index_sequence<BoundIndices...>>;
template <typename Is, std::size_t J>
struct AppendToIndexSequence;
AppendToIndexSequenceT;
AppendToIndexSequence<index_sequence<Is...>, J>;
template <class ReturnType, class FunctionObject, class EndIndices,
class CurrIndices, class BoundIndices>
struct MakeVisitationMatrixImpl;
MakeVisitationMatrixImpl<ReturnType, FunctionObject, EndIndices, index_sequence<CurrIndices...>, BoundIndices>;
MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<HeadEndIndex, TailEndIndices...>, index_sequence<BoundIndices...>>;
struct UnreachableSwitchCase { … };
template <class Op, std::size_t I>
struct ReachableSwitchCase { … };
ABSL_INTERNAL_INLINE_CONSTEXPR(std::size_t, MaxUnrolledVisitCases, 33);
template <bool IsReachable>
struct PickCaseImpl { … };
template <>
struct PickCaseImpl<true> { … };
PickCase;
template <class ReturnType>
[[noreturn]] ReturnType TypedThrowBadVariantAccess() { … }
template <std::size_t... NumAlternatives>
struct NumCasesOfSwitch;
NumCasesOfSwitch<HeadNumAlternatives, TailNumAlternatives...>;
template <>
struct NumCasesOfSwitch<> { … };
template <std::size_t EndIndex>
struct VisitIndicesSwitch { … };
template <std::size_t... EndIndices>
struct VisitIndicesFallback { … };
template <std::size_t...>
struct FlattenIndices;
FlattenIndices<HeadSize, TailSize...>;
template <>
struct FlattenIndices<> { … };
template <std::size_t I, std::size_t IndexToGet, std::size_t HeadSize,
std::size_t... TailSize>
struct UnflattenIndex { … };
UnflattenIndex<I, 0, HeadSize, TailSize...>;
template <class IndexSequence, std::size_t... EndIndices>
struct VisitIndicesVariadicImpl;
VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...>;
template <std::size_t... EndIndices>
struct VisitIndicesVariadic
: VisitIndicesVariadicImpl<absl::make_index_sequence<sizeof...(EndIndices)>,
EndIndices...> { … };
template <std::size_t... EndIndices>
struct VisitIndices
: absl::conditional_t<(NumCasesOfSwitch<EndIndices...>::value <=
MaxUnrolledVisitCases),
VisitIndicesVariadic<EndIndices...>,
VisitIndicesFallback<EndIndices...>> { … };
VisitIndices<EndIndex>;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4172)
#endif
template <class Self, std::size_t I>
inline VariantAccessResult<I, Self> AccessUnion(Self&& self, SizeT<I> ) { … }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
template <class T>
void DeducedDestroy(T& self) { … }
struct VariantCoreAccess { … };
template <class Expected, class... T>
struct IndexOfImpl;
IndexOfImpl<Expected>;
IndexOfImpl<Expected, Head, Tail...>;
IndexOfImpl<Expected, Expected, Tail...>;
template <class Expected, class... Types>
struct IndexOfMeta { … };
IndexOf;
template <class Variant, class T, std::size_t CurrIndex>
struct UnambiguousIndexOfImpl;
UnambiguousIndexOfImpl<variant<>, T, CurrIndex>;
UnambiguousIndexOfImpl<variant<Head, Tail...>, T, CurrIndex>;
UnambiguousIndexOfImpl<variant<Head, Tail...>, Head, CurrIndex>;
template <class Variant, class T>
struct UnambiguousIndexOf;
struct NoMatch { … };
UnambiguousIndexOf<variant<Alts...>, T>;
UnambiguousTypeOfImpl;
UnambiguousTypeOfT;
template <class H, class... T>
class VariantStateBase;
template <class Variant, std::size_t I = 0>
struct ImaginaryFun;
ImaginaryFun<variant<>, I>;
ImaginaryFun<variant<H, T...>, I>;
template <class Self, class T>
struct IsNeitherSelfNorInPlace : std::true_type { … };
IsNeitherSelfNorInPlace<Self, Self>;
IsNeitherSelfNorInPlace<Self, in_place_type_t<T>>;
IsNeitherSelfNorInPlace<Self, in_place_index_t<I>>;
IndexOfConstructedType<Variant, T, void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>;
template <std::size_t... Is>
struct ContainsVariantNPos
: absl::negation<std::is_same<
std::integer_sequence<bool, 0 <= Is...>,
std::integer_sequence<bool, Is != absl::variant_npos...>>> { … };
RawVisitResult;
template <class Op, class... QualifiedVariants>
struct VisitResultImpl { … };
VisitResult;
template <class Op, class... QualifiedVariants>
struct PerformVisitation { … };
template <class... T>
union Union;
struct NoopConstructorTag { … };
template <std::size_t I>
struct EmplaceTag { … };
Union<>;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4624)
#endif
Union<Head, Tail...>;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
template <class... T>
union DestructibleUnionImpl;
DestructibleUnionImpl<>;
DestructibleUnionImpl<Head, Tail...>;
DestructibleUnion;
template <class H, class... T>
class VariantStateBase { … };
type_identity;
template <typename... Ts>
struct OverloadSet;
OverloadSet<T, Ts...>;
template <>
struct OverloadSet<> { … };
LessThanResult;
GreaterThanResult;
LessThanOrEqualResult;
GreaterThanOrEqualResult;
EqualResult;
NotEqualResult;
is_detected_convertible;
RequireAllHaveEqualT;
RequireAllHaveNotEqualT;
RequireAllHaveLessThanT;
RequireAllHaveLessThanOrEqualT;
RequireAllHaveGreaterThanOrEqualT;
RequireAllHaveGreaterThanT;
template <typename T>
struct VariantHelper;
VariantHelper<variant<Ts...>>;
struct TrivialMoveOnly { … };
template <typename T>
struct IsTriviallyMoveConstructible
: std::is_move_constructible<Union<T, TrivialMoveOnly>> { … };
template <class... T>
class VariantStateBaseDestructorNontrivial;
template <class... T>
class VariantMoveBaseNontrivial;
template <class... T>
class VariantCopyBaseNontrivial;
template <class... T>
class VariantMoveAssignBaseNontrivial;
template <class... T>
class VariantCopyAssignBaseNontrivial;
VariantStateBaseDestructor;
VariantMoveBase;
VariantCopyBase;
VariantMoveAssignBase;
VariantCopyAssignBase;
VariantBase;
template <class... T>
class VariantStateBaseDestructorNontrivial : protected VariantStateBase<T...> { … };
template <class... T>
class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> { … };
template <class... T>
class VariantCopyBaseNontrivial : protected VariantMoveBase<T...> { … };
template <class... T>
class VariantMoveAssignBaseNontrivial : protected VariantCopyBase<T...> { … };
template <class... T>
class VariantCopyAssignBaseNontrivial : protected VariantMoveAssignBase<T...> { … };
template <class... Types>
struct EqualsOp { … };
template <class... Types>
struct NotEqualsOp { … };
template <class... Types>
struct LessThanOp { … };
template <class... Types>
struct GreaterThanOp { … };
template <class... Types>
struct LessThanOrEqualsOp { … };
template <class... Types>
struct GreaterThanOrEqualsOp { … };
template <class... Types>
struct SwapSameIndex { … };
template <class... Types>
struct Swap { … };
template <typename Variant, typename = void, typename... Ts>
struct VariantHashBase { … };
struct VariantHashVisitor { … };
VariantHashBase<Variant, absl::enable_if_t<absl::conjunction<type_traits_internal::IsHashable<Ts>...>::value>, Ts...>;
}
ABSL_NAMESPACE_END
}
#endif
#endif