in fboss/cli/fboss2/tabulate/variant_lite.hpp [572:909]
template <class U> inline TX<T> operator<<(U const &) const { return TX<T>(); }
template <class U> inline TX<T> operator>>(U const &) const { return TX<T>(); }
inline bool operator==(T const &) const { return false; }
inline bool operator<(T const &) const { return false; }
template <class U> inline TX<T> operator&(U const &)const { return TX<T>(); }
template <class U> inline TX<T> operator|(U const &) const { return TX<T>(); }
template <class U> inline TX<T> operator^(U const &) const { return TX<T>(); }
template <class U> inline TX<T> operator&&(U const &) const { return TX<T>(); }
template <class U> inline TX<T> operator||(U const &) const { return TX<T>(); }
};
struct S0 {};
typedef TX<S0> T0;
struct S1 {};
typedef TX<S1> T1;
struct S2 {};
typedef TX<S2> T2;
struct S3 {};
typedef TX<S3> T3;
struct S4 {};
typedef TX<S4> T4;
struct S5 {};
typedef TX<S5> T5;
struct S6 {};
typedef TX<S6> T6;
struct S7 {};
typedef TX<S7> T7;
struct S8 {};
typedef TX<S8> T8;
struct S9 {};
typedef TX<S9> T9;
struct S10 {};
typedef TX<S10> T10;
struct S11 {};
typedef TX<S11> T11;
struct S12 {};
typedef TX<S12> T12;
struct S13 {};
typedef TX<S13> T13;
struct S14 {};
typedef TX<S14> T14;
struct S15 {};
typedef TX<S15> T15;
struct nulltype {};
template <class Head, class Tail> struct typelist {
typedef Head head;
typedef Tail tail;
};
// typelist max element size:
template <class List> struct typelist_max;
template <> struct typelist_max<nulltype> {
enum V { value = 0 };
typedef void type;
};
template <class Head, class Tail> struct typelist_max<typelist<Head, Tail>> {
private:
enum TV { tail_value = size_t(typelist_max<Tail>::value) };
typedef typename typelist_max<Tail>::type tail_type;
public:
enum V { value = (sizeof(Head) > tail_value) ? sizeof(Head) : std::size_t(tail_value) };
typedef typename std11::conditional<(sizeof(Head) > tail_value), Head, tail_type>::type type;
};
#if variant_CPP11_OR_GREATER
// typelist max alignof element type:
template <class List> struct typelist_max_alignof;
template <> struct typelist_max_alignof<nulltype> {
enum V { value = 0 };
};
template <class Head, class Tail> struct typelist_max_alignof<typelist<Head, Tail>> {
private:
enum TV { tail_value = size_t(typelist_max_alignof<Tail>::value) };
public:
enum V { value = (alignof(Head) > tail_value) ? alignof(Head) : std::size_t(tail_value) };
};
#endif
// typelist size (length):
template <class List> struct typelist_size {
enum V { value = 1 };
};
template <> struct typelist_size<T0> {
enum V { value = 0 };
};
template <> struct typelist_size<T1> {
enum V { value = 0 };
};
template <> struct typelist_size<T2> {
enum V { value = 0 };
};
template <> struct typelist_size<T3> {
enum V { value = 0 };
};
template <> struct typelist_size<T4> {
enum V { value = 0 };
};
template <> struct typelist_size<T5> {
enum V { value = 0 };
};
template <> struct typelist_size<T6> {
enum V { value = 0 };
};
template <> struct typelist_size<T7> {
enum V { value = 0 };
};
template <> struct typelist_size<T8> {
enum V { value = 0 };
};
template <> struct typelist_size<T9> {
enum V { value = 0 };
};
template <> struct typelist_size<T10> {
enum V { value = 0 };
};
template <> struct typelist_size<T11> {
enum V { value = 0 };
};
template <> struct typelist_size<T12> {
enum V { value = 0 };
};
template <> struct typelist_size<T13> {
enum V { value = 0 };
};
template <> struct typelist_size<T14> {
enum V { value = 0 };
};
template <> struct typelist_size<T15> {
enum V { value = 0 };
};
template <> struct typelist_size<nulltype> {
enum V { value = 0 };
};
template <class Head, class Tail> struct typelist_size<typelist<Head, Tail>> {
enum V { value = typelist_size<Head>::value + typelist_size<Tail>::value };
};
// typelist index of type:
template <class List, class T> struct typelist_index_of;
template <class T> struct typelist_index_of<nulltype, T> {
enum V { value = -1 };
};
template <class Tail, class T> struct typelist_index_of<typelist<T, Tail>, T> {
enum V { value = 0 };
};
template <class Head, class Tail, class T> struct typelist_index_of<typelist<Head, Tail>, T> {
private:
enum TV { nextVal = typelist_index_of<Tail, T>::value };
public:
enum V { value = nextVal == -1 ? -1 : 1 + nextVal };
};
// typelist type at index:
template <class List, std::size_t i> struct typelist_type_at;
template <class Head, class Tail> struct typelist_type_at<typelist<Head, Tail>, 0> {
typedef Head type;
};
template <class Head, class Tail, std::size_t i> struct typelist_type_at<typelist<Head, Tail>, i> {
typedef typename typelist_type_at<Tail, i - 1>::type type;
};
#if variant_CONFIG_MAX_ALIGN_HACK
// Max align, use most restricted type for alignment:
#define variant_UNIQUE(name) variant_UNIQUE2(name, __LINE__)
#define variant_UNIQUE2(name, line) variant_UNIQUE3(name, line)
#define variant_UNIQUE3(name, line) name##line
#define variant_ALIGN_TYPE(type) \
type variant_UNIQUE(_t); \
struct_t<type> variant_UNIQUE(_st)
template <class T> struct struct_t { T _; };
union max_align_t {
variant_ALIGN_TYPE(char);
variant_ALIGN_TYPE(short int);
variant_ALIGN_TYPE(int);
variant_ALIGN_TYPE(long int);
variant_ALIGN_TYPE(float);
variant_ALIGN_TYPE(double);
variant_ALIGN_TYPE(long double);
variant_ALIGN_TYPE(char *);
variant_ALIGN_TYPE(short int *);
variant_ALIGN_TYPE(int *);
variant_ALIGN_TYPE(long int *);
variant_ALIGN_TYPE(float *);
variant_ALIGN_TYPE(double *);
variant_ALIGN_TYPE(long double *);
variant_ALIGN_TYPE(void *);
#ifdef HAVE_LONG_LONG
variant_ALIGN_TYPE(long long);
#endif
struct Unknown;
Unknown (*variant_UNIQUE(_))(Unknown);
Unknown *Unknown::*variant_UNIQUE(_);
Unknown (Unknown::*variant_UNIQUE(_))(Unknown);
struct_t<Unknown (*)(Unknown)> variant_UNIQUE(_);
struct_t<Unknown * Unknown::*> variant_UNIQUE(_);
struct_t<Unknown (Unknown::*)(Unknown)> variant_UNIQUE(_);
};
#undef variant_UNIQUE
#undef variant_UNIQUE2
#undef variant_UNIQUE3
#undef variant_ALIGN_TYPE
#elif defined(variant_CONFIG_ALIGN_AS) // variant_CONFIG_MAX_ALIGN_HACK
// Use user-specified type for alignment:
#define variant_ALIGN_AS(unused) variant_CONFIG_ALIGN_AS
#else // variant_CONFIG_MAX_ALIGN_HACK
// Determine POD type to use for alignment:
#define variant_ALIGN_AS(to_align) \
typename detail::type_of_size<detail::alignment_types, \
detail::alignment_of<to_align>::value>::type
template <typename T> struct alignment_of;
template <typename T> struct alignment_of_hack {
char c;
T t;
alignment_of_hack();
};
template <size_t A, size_t S> struct alignment_logic {
enum V { value = A < S ? A : S };
};
template <typename T> struct alignment_of {
enum V { value = alignment_logic<sizeof(alignment_of_hack<T>) - sizeof(T), sizeof(T)>::value };
};
template <typename List, size_t N> struct type_of_size {
typedef
typename std11::conditional<N == sizeof(typename List::head), typename List::head,
typename type_of_size<typename List::tail, N>::type>::type type;
};
template <size_t N> struct type_of_size<nulltype, N> {
typedef variant_CONFIG_ALIGN_AS_FALLBACK type;
};
template <typename T> struct struct_t { T _; };
#define variant_ALIGN_TYPE(type) typelist < type, typelist < struct_t<type>
struct Unknown;
typedef variant_ALIGN_TYPE(char), variant_ALIGN_TYPE(short), variant_ALIGN_TYPE(int),
variant_ALIGN_TYPE(long), variant_ALIGN_TYPE(float), variant_ALIGN_TYPE(double),
variant_ALIGN_TYPE(long double),
variant_ALIGN_TYPE(char *), variant_ALIGN_TYPE(short *), variant_ALIGN_TYPE(int *),
variant_ALIGN_TYPE(long *), variant_ALIGN_TYPE(float *), variant_ALIGN_TYPE(double *),
variant_ALIGN_TYPE(long double *),
variant_ALIGN_TYPE(Unknown (*)(Unknown)), variant_ALIGN_TYPE(Unknown *Unknown::*),
variant_ALIGN_TYPE(Unknown (Unknown::*)(Unknown)),
nulltype >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> alignment_types;
#undef variant_ALIGN_TYPE
#endif // variant_CONFIG_MAX_ALIGN_HACK
#if variant_CPP11_OR_GREATER
template <typename T> inline std::size_t hash(T const &v) { return std::hash<T>()(v); }
inline std::size_t hash(T0 const &) { return 0; }
inline std::size_t hash(T1 const &) { return 0; }
inline std::size_t hash(T2 const &) { return 0; }
inline std::size_t hash(T3 const &) { return 0; }
inline std::size_t hash(T4 const &) { return 0; }
inline std::size_t hash(T5 const &) { return 0; }
inline std::size_t hash(T6 const &) { return 0; }
inline std::size_t hash(T7 const &) { return 0; }
inline std::size_t hash(T8 const &) { return 0; }
inline std::size_t hash(T9 const &) { return 0; }
inline std::size_t hash(T10 const &) { return 0; }
inline std::size_t hash(T11 const &) { return 0; }
inline std::size_t hash(T12 const &) { return 0; }
inline std::size_t hash(T13 const &) { return 0; }
inline std::size_t hash(T14 const &) { return 0; }
inline std::size_t hash(T15 const &) { return 0; }
#endif // variant_CPP11_OR_GREATER
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8,
class T9, class T10, class T11, class T12, class T13, class T14, class T15>
struct helper {
typedef signed char type_index_t;
typedef variant_TL16(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
T15) variant_types;
template <class U> static U *as(void *data) { return reinterpret_cast<U *>(data); }
template <class U> static U const *as(void const *data) {