ECSTASY
All in the name
Loading...
Searching...
No Matches
index.hpp
Go to the documentation of this file.
1
11
12#ifndef UTIL_META_FIND_HPP_
13#define UTIL_META_FIND_HPP_
14
15#include <type_traits>
16
17namespace util::meta
18{
30 template <typename T, typename... Ts>
31 struct index;
32
34 template <typename T, typename... Ts>
35 struct index<T, T, Ts...> : std::integral_constant<std::size_t, 0> {};
36
38 template <typename T, typename U, typename... Ts>
39 struct index<T, U, Ts...> : std::integral_constant<std::size_t, 1 + index<T, Ts...>::value> {};
40
50 template <typename T, typename... Ts>
51 constexpr inline std::size_t index_v = index<T, Ts...>::value;
52
53} // namespace util::meta
54
55#endif /* !UTIL_META_CONTAINS_HPP_ */
Namespace regrouping all meta programmation helper types.
constexpr std::size_t index_v
Helper for index<...>::type.
Definition index.hpp:51
Get the index of the first occurence of type T in the types Ts.
Definition index.hpp:31