5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_INDEX_OF_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_INDEX_OF_HPP_
13#include "arene/base/stdlib_choice/cstddef.hpp"
14#include "arene/base/stdlib_choice/initializer_list.hpp"
15#include "arene/base/stdlib_choice/integral_constant.hpp"
16#include "arene/base/stdlib_choice/is_same.hpp"
21namespace index_of_detail {
27constexpr auto index_of_first_true(std::initializer_list<bool> values)
noexcept ->
std::size_t {
30 for (
bool const value : values) {
45constexpr auto index_of_last_true(std::initializer_list<bool>
const values)
noexcept ->
std::size_t {
47 bool const*
const ptr{values.begin()};
68template <
typename T,
typename... Ts>
77template <
typename T,
typename... Ts>
82class empty_index_of_base {};
98template <
typename T,
typename... Ts>
101 index_of_detail::type_index_of_v<T, Ts...> == sizeof...(Ts),
102 index_of_detail::empty_index_of_base,
103 std::integral_constant<std::size_t, index_of_detail::type_index_of_v<T, Ts...>>> {};
113template <
typename T,
typename... Ts>
127template <
typename T,
typename... Ts>
130 index_of_detail::last_type_index_of_v<T, Ts...> == sizeof...(Ts),
131 index_of_detail::empty_index_of_base,
132 std::integral_constant<std::size_t, index_of_detail::last_type_index_of_v<T, Ts...>>> {};
141template <
typename T,
typename... Ts>
Template meta-function for querying the 0-based index of a type in a list of types.
Definition index_of.hpp:103
Template meta-function for querying the last 0-based index of a type in a list of types.
Definition index_of.hpp:132
static constexpr value_type value
Definition integral_constant.hpp:34
Definition accumulate.hpp:37
constexpr auto last_index_of_v
Template meta-function for querying the last 0-based index of 'T' within a list of types,...
typename static_if< B >::template then_else< T, F > conditional_t
lazily select between two types based on a boolean condition
Definition conditional.hpp:28
constexpr auto index_of_v
Template meta-function for querying the 0-based index of 'T' within a list of types,...
Definition accumulate.hpp:36
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29