https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100157
m.cencora at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.cencora at gmail dot com --- Comment #2 from m.cencora at gmail dot com --- Please consider also adding a builtin for fetching index of type in type list. While there are some easy implementations (like following), they are still not very performant. template <typename T> constexpr auto uniqId() { return __PRETTY_FUNCTION__; } template <typename U, unsigned N> constexpr unsigned index_of_impl(U needle, const U (&haystack)[N]) { for (unsigned i = 0u; i != N; ++i) { if (haystack[i] == needle) { return i; } } return -1; } template <typename T, typename ...Ts> constexpr auto index_of_v = index_of_impl(uniqId<T>, { uniqId<Ts>...}); using T1 = float; using T2 = int; struct A; struct B; auto c = index_of_v<A, T2, B, A, T1>;