12#include "detray/definitions/indexing.hpp"
18namespace detray::detail {
36template <
typename container_t>
37 requires(!std::same_as<typename std::remove_cvref_t<container_t>::value_type,
41 using type =
typename std::remove_cvref_t<container_t>::value_type;
50template <
typename first_t = void,
typename... other_t>
56template <
typename... TYPES>
57using first_t =
typename first_type<TYPES...>::type;
60template <std::size_t first_t, std::size_t... other_t>
63 static constexpr std::size_t
value = first_t;
66template <std::size_t... TYPES>
67inline constexpr std::size_t first_idx_v =
first_idx<TYPES...>::value;
72template <
typename T,
typename... Ts>
79 template <
typename first_t,
typename... remaining_types>
81 if constexpr (!std::is_same_v<T, first_t>) {
84 if constexpr (std::is_same_v<T, first_t>) {
85 return sizeof...(remaining_types) + 1;
87 return std::numeric_limits<std::size_t>::max();
94template <
typename T,
typename... Ts>
95inline constexpr std::size_t get_type_pos_v =
get_type_pos<T, Ts...>::value;
Extract the first value from an index pack.
Definition type_traits.hpp:61
static constexpr std::size_t value
The first index in the pack.
Definition type_traits.hpp:63
Extract the first type from a parameter pack.
Definition type_traits.hpp:51
first_t type
The first type in the pack, or void for an empty pack.
Definition type_traits.hpp:53
Get the position of a type in a template parameter pack.
Definition type_traits.hpp:73
static constexpr std::size_t type_pos_back()
Unroll a parameter pack without using a tuple to find T.
Definition type_traits.hpp:80
static constexpr std::size_t value
Zero-based position of T in Ts....
Definition type_traits.hpp:91
T type
The pointee type.
Definition type_traits.hpp:32
typename std::remove_cvref_t< container_t >::value_type type
The container's value type.
Definition type_traits.hpp:41
Extract the value type of e.g.
Definition type_traits.hpp:23
T type
The type itself when the argument is not a container or pointer.
Definition type_traits.hpp:25