From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 451853856DD4 for ; Tue, 14 Jun 2022 21:53:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 451853856DD4 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-cbsNapa3OUG5lpk9UfWcjQ-1; Tue, 14 Jun 2022 17:53:13 -0400 X-MC-Unique: cbsNapa3OUG5lpk9UfWcjQ-1 Received: by mail-yb1-f199.google.com with SMTP id u128-20020a25dd86000000b0066073927e92so8710238ybg.13 for ; Tue, 14 Jun 2022 14:53:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WvdXpH8NnwukcFk/uWuB+M0QrlLU4na1plnNvbRVAWI=; b=KlHJ2dH3M1UxVeiXT5GgUAMNLvMqiTxgE/2HcAWn3hfXdsK2zg/+/GSVQ8dnXJhR4I DSwLCVYytACRgbKcW1tv7aR56xkroh15Oas3J7gS6gsXe7Rm9rz/IVkcTCuwVCdyBwfe GDWPgn+4ixjC7Gicc4l0wX66BgB+HTVGXQ/OjSKNcbtRJ/R4v7LEF7LiLxZRJQJsk8hH JNaWeN0Va0yEV3/BvkbyCPHy9onkBAIPDDUR69DzJhkS0+3mwpQjem7ZGusxmBJT7HBq vEvtLtYnTFb5T6tUkg5qskoYPALQKA2wOJRfWnNpeGd5ba+nHp9vOlpHhghT3dsE0NH4 ieTQ== X-Gm-Message-State: AJIora8uGt/nRoUngJ+S6HvpQBZ/43G83xVPV1jdlr7chS1doBrRJbr1 /uwCKjgZmYW/PSVuTDCbY2ajodpTfFdOXzDnOKJIA415JbXUV06GGFyIGxTI/7MnbLD3qksInV+ y9TrRnRZc4FuIxb4Q4Ej0PEq/AJYu/Sg= X-Received: by 2002:a81:1358:0:b0:30c:2e28:4050 with SMTP id 85-20020a811358000000b0030c2e284050mr7921333ywt.206.1655243593230; Tue, 14 Jun 2022 14:53:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5Gq1pldwj4jUP6KUnc8pYkCVitq/K11XLQvZPi3ZjJ8uC/Gn5BsZtvgoEb43dohdfnvFcdyfjXTzdGkNO5Tc= X-Received: by 2002:a81:1358:0:b0:30c:2e28:4050 with SMTP id 85-20020a811358000000b0030c2e284050mr7921313ywt.206.1655243593042; Tue, 14 Jun 2022 14:53:13 -0700 (PDT) MIME-Version: 1.0 References: <2fe3937d-1b9a-a547-bb41-225d3d5426a2@gmail.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 14 Jun 2022 22:53:01 +0100 Message-ID: Subject: Re: [PATCH][_Hashtable] Fix insertion of range of type convertible to value_type PR 105714 To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++@gcc.gnu.org" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 21:53:16 -0000 On Wed, 25 May 2022 at 06:10, Fran=C3=A7ois Dumont w= rote: > > Here is the patch to fix just what is described in PR 105714. > > libstdc++: [_Hashtable] Insert range of types convertible to > value_type PR 105714 > > Fix insertion of range of types convertible to value_type. > > libstdc++-v3/ChangeLog: > > PR libstdc++/105714 > * include/bits/hashtable_policy.h (_ValueTypeEnforcer): New. > * include/bits/hashtable.h > (_Hashtable<>::_M_insert_unique_aux): New. > (_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, > true_type)): Use latters. > (_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, > false_type)): Likewise. > (_Hashtable(_InputIterator, _InputIterator, size_type, > const _Hash&, const _Equal&, > const allocator_type&, true_type)): Use this.insert range. > (_Hashtable(_InputIterator, _InputIterator, size_type, > const _Hash&, const _Equal&, > const allocator_type&, false_type)): Use _M_insert. > * testsuite/23_containers/unordered_map/cons/56112.cc: > Check how many times conversion > is done. > * testsuite/23_containers/unordered_map/insert/105714.cc: > New test. > * testsuite/23_containers/unordered_set/insert/105714.cc: > New test. > > Tested under Linux x64, ok to commit ? I think "_ConvertToValueType" would be a better name than _ValueTypeEnforcer, and all overloads of _ValueTypeEnforcer can be const. OK with that change, thanks.