15 #ifndef CORE_UTIL_TUPLE_H_
16 #define CORE_UTIL_TUPLE_H_
18 #include <type_traits>
33 template <
typename TTuple,
typename TFunction,
size_t TIndex>
35 function(&std::get<TIndex>(*t));
41 template <
typename TTuple,
typename TFunction,
size_t... TIndices>
42 void Apply(TTuple* t,
size_t index, TFunction&& f,
43 std::index_sequence<TIndices...>) {
44 using ApplyImplSignature = void(TTuple*, TFunction &&);
46 static constexpr ApplyImplSignature* kLut[] = {
47 &ApplyImpl<TTuple, TFunction, TIndices>...};
51 template <
typename T,
size_t Counter,
typename... Types>
54 template <
typename T,
size_t Counter,
typename FirstType>
57 if (std::is_same<T, FirstType>::value) {
65 template <
typename T,
size_t Counter,
typename FirstType,
66 typename... RemainingTypes>
70 if (std::is_same<T, FirstType>::value) {
87 template <
typename TTuple,
typename TFunction>
88 void Apply(TTuple* t,
size_t index, TFunction&& f) {
90 std::make_index_sequence<std::tuple_size<TTuple>::value>());
95 template <
typename T,
typename... Types>
97 return bdm::detail::template GetIndexImpl<T, 0, Types...>::GetValue();
102 #endif // CORE_UTIL_TUPLE_H_