From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4C3B0386EC02; Thu, 30 Jun 2022 10:39:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C3B0386EC02 From: "m.cencora at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100157] Support `__type_pack_element` like Clang Date: Thu, 30 Jun 2022 10:39:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: m.cencora at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 10:39:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100157 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 li= st. While there are some easy implementations (like following), they are still = not very performant. template constexpr auto uniqId() { return __PRETTY_FUNCTION__; } template constexpr unsigned index_of_impl(U needle, const U (&haystack)[N]) { for (unsigned i =3D 0u; i !=3D N; ++i) { if (haystack[i] =3D=3D needle) { return i; } } return -1; } template constexpr auto index_of_v =3D index_of_impl(uniqId, { uniqId...}); using T1 =3D float; using T2 =3D int; struct A; struct B; auto c =3D index_of_v;=