A
Size: a a a
CD
CD
CD
CD
constexpr auto f()
{
std::optional<size_t> index;
static_for<0, 7>([&index](auto i) {
if (!index) // The index of the first occurrence is stored
{
if constexpr (std::is_same_v < char, pack::type_by_index < static_cast<size_t>(decltype(i){}), char, int, float, double, int64_t, uint64_t, void >> )
index = static_cast<size_t>(decltype(i){});
}
});
return index;
}
CD
CD
static constexpr auto idOf = *f();
static_assert(idOf == 0);
CD
constexpr auto f() noexcept
{
constexpr auto index = pack::index_for_type<char, char, int, float, double, int64_t, uint64_t, void>();
static_assert (index, "Type not found in pack");
return *index;
}
static constexpr auto idOf = f();
static_assert(!idOf);
A
constexpr auto f() noexcept
{
constexpr auto index = pack::index_for_type<char, char, int, float, double, int64_t, uint64_t, void>();
static_assert (index, "Type not found in pack");
return *index;
}
static constexpr auto idOf = f();
static_assert(!idOf);
CD
A
CD
CD