tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
index_of.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_META_INDEX_OF_HPP
4#define TETL_META_INDEX_OF_HPP
5
7#include <etl/_meta/list.hpp>
9
10namespace etl::meta {
11
12template <typename T, typename List>
13struct index_of;
14
15template <typename T, typename List>
16inline constexpr auto index_of_v = index_of<T, List>::value;
17
18template <typename Head, typename... Tail>
19struct index_of<Head, list<Head, Tail...>> : etl::integral_constant<etl::size_t, 0> { };
20
21template <typename T, typename Head, typename... Tail>
22struct index_of<T, list<Head, Tail...>> : etl::integral_constant<etl::size_t, index_of_v<T, list<Tail...>> + 1> { };
23
24} // namespace etl::meta
25
26#endif // TETL_META_INDEX_OF_HPP
Definition at.hpp:9
constexpr auto index_of_v
Definition index_of.hpp:16
Definition integral_constant.hpp:9
Definition index_of.hpp:13
Definition list.hpp:10