18 template <
size_t Size,
typename...>
22 template <
size_t Size>
25 template <
typename InKey>
28 static constexpr size_t index = Size;
31 template <
size_t Index>
38 template <
size_t Size,
typename Key,
typename Value,
typename... Rest>
42 return Size - 1u -
sizeof...(Rest);
46 template <
typename InKey>
48 using type =
typename std::conditional<
49 std::is_same<InKey, Key>::value,
53 static constexpr size_t index =
54 std::is_same<InKey, Key>::value ?
60 template <
size_t Index>
62 using type =
typename std::conditional<
63 Index == current_index(),
68 using key =
typename std::conditional<
69 Index == current_index(),
87 template <
typename... Items>
90 static constexpr size_t size() {
91 return sizeof...(Items);
94 template <
typename InKey>
97 template <
size_t Index>
一个编译时结构,用于映射两种类型。可以通过键或索引查找元素。
typename detail::CompileTimeTypeMapImpl< sizeof...(Items), Items... >::template get_by_index< Index > get_by_index
static constexpr size_t size()
typename detail::CompileTimeTypeMapImpl< sizeof...(Items), Items... >::template get< InKey > get
static constexpr size_t current_index()
typename std::conditional< Index==current_index(), Key, typename CompileTimeTypeMapImpl< Size, Rest... >::template get_by_index< Index >::key >::type key
typename std::conditional< Index==current_index(), Value, typename CompileTimeTypeMapImpl< Size, Rest... >::template get_by_index< Index >::type >::type type
typename std::conditional< std::is_same< InKey, Key >::value, Value, typename CompileTimeTypeMapImpl< Size, Rest... >::template get< InKey >::type >::type type