From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E9ADC386EC04; Thu, 30 Jun 2022 11:11:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9ADC386EC04 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100157] Support `__type_pack_element` like Clang Date: Thu, 30 Jun 2022 11:11:38 +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: redi at gcc dot gnu.org 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: 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 11:11:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100157 --- Comment #3 from Jonathan Wakely --- (In reply to m.cencora from comment #2) > Please consider also adding a builtin for fetching index of type in type > list. I am already considering it and it's one of the reasons I don't like the na= me "type pack element". That name isn't easily extensible to the reverse case. I would prefer a pair of similar names involving "type at index" and "index= of type" or something like that. Or "index to type" and "tpe to index". > While there are some easy implementations (like following), they are still > not very performant. The uses in the standard library also require an error if the type occurs m= ore than once, which yours doesn't check. I intend to add a built-in that suppo= rts both cases with a boolean flag to say whether to fail if the type is repeat= ed. FWIW I think __find_uniq_type_in_pack() in libstdc++'s sca= les better than yours (and checks for uniqueness).=