public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100157] Support `__type_pack_element` like Clang Date: Thu, 30 Jun 2022 11:44:01 +0000 [thread overview] Message-ID: <bug-100157-4-R9DCvZtk5h@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100157-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100157 --- Comment #5 from m.cencora at gmail dot com --- Yeah, __is_same builtin beats custom unique-id comparisons, but it is available only since gcc-10 so unavailable for me. Recently I discovered this one (only works for unique types), and it is twice as fast as __is_same in my scenarios (I guess mainly due to memoization): template <typename T> struct indexed_type { unsigned idx; }; template <typename ...Ts> struct indexed_type_list : indexed_type<Ts>... { constexpr indexed_type_list(unsigned i = 0) : indexed_type<Ts>{i++}... {} }; template <typename ...Ts> constexpr indexed_type_list<Ts...> indexed_type_list_instance; template <typename T, typename ...Ts> constexpr auto index_of = static_cast<indexed_type<T>>(indexed_type_list_instance<Ts...>).idx; Anyway, thanks for working on this topic!
next prev parent reply other threads:[~2022-06-30 11:44 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-20 17:44 [Bug c++/100157] New: " vittorio.romeo at outlook dot com 2021-04-21 6:21 ` [Bug c++/100157] " rguenth at gcc dot gnu.org 2022-06-29 23:27 ` redi at gcc dot gnu.org 2022-06-29 23:33 ` redi at gcc dot gnu.org 2022-06-29 23:38 ` redi at gcc dot gnu.org 2022-06-30 10:39 ` m.cencora at gmail dot com 2022-06-30 11:11 ` redi at gcc dot gnu.org 2022-06-30 11:19 ` redi at gcc dot gnu.org 2022-06-30 11:44 ` m.cencora at gmail dot com [this message] 2022-06-30 12:46 ` vittorio.romeo at outlook dot com 2022-06-30 13:05 ` redi at gcc dot gnu.org 2022-06-30 13:08 ` redi at gcc dot gnu.org 2022-06-30 13:09 ` vittorio.romeo at outlook dot com 2022-06-30 13:14 ` redi at gcc dot gnu.org 2022-11-29 15:28 ` pdimov at gmail dot com 2023-04-19 19:37 ` cvs-commit at gcc dot gnu.org 2023-04-26 6:55 ` rguenth at gcc dot gnu.org 2023-04-26 8:08 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100157-4-R9DCvZtk5h@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).