Program Listing for File index_of_impl_.hpp¶
↰ Return to documentation for file (include/ripple/utility/detail/index_of_impl_.hpp
)
#ifndef RIPPLE_UTILITY_DETAIL_INDEX_OF_IMPL__HPP
#define RIPPLE_UTILITY_DETAIL_INDEX_OF_IMPL__HPP
#include <type_traits>
namespace ripple::detail {
template <int I, typename T, typename... Ts>
struct IndexOf;
template <int I, typename T, typename U, typename... Ts>
struct IndexOf<I, T, U, Ts...> {
static constexpr auto value =
std::is_same_v<T, U> ? I : IndexOf<I + 1, T, Ts...>::value;
};
template <int I, typename T>
struct IndexOf<I, T> {
static constexpr auto value = I;
};
} // namespace ripple::detail
#endif // RIPPLE_UTILITY_DETAIL_INDEX_OF_IMPL__HPP