From patchwork Wed Sep 7 00:45:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp904527wrt; Tue, 6 Sep 2022 17:47:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gArVoJ2aeRavlKi81Plig3xCVtU17vRQ7mA2DmjZSt3mRBmtfQ3231PEmZh2GMi6tVtEo X-Received: by 2002:a17:906:3a15:b0:73d:80bf:542c with SMTP id z21-20020a1709063a1500b0073d80bf542cmr652933eje.633.1662511652855; Tue, 06 Sep 2022 17:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662511652; cv=none; d=google.com; s=arc-20160816; b=AEyfYjrid2o08UTWkNXK8DxMg8QkCI3BT2+Z5+UWxZeynEwpikIsSN2WydF7poXWdW Fj4/rdy03c5XhqdryUBMIx2gAjh8AH66dnw0Kdue49HPxHdQEqcjpkilxF+08Eq976X0 o2SGBBp/MfEm4iqPQEBKCwa7aZNFm8r0nl0laF0hvLTotjhIlaYDMRq8Fu2tjabO7nX8 1YqI5OedpWMzBcGGBUEHyFpJG7KSZzhSGz9+6pMHkdLDT1auoixTifCs5Jhb9jJjEern DXicmGKG1ZBTxacK3g0XBRYO1fc4kSjXBzC4MKVG8MNa0vZ11p11IKdYzwJpyLjMMsmp UHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=b4uZcVb1yB1//IU5rEE8/SASvFhEs8GgdRtORueOyJM=; b=ZDu2v+omiHqac+zS34NfxdR3h2hmJcsZbWPJw39OL1H79flhfMoWmT42duTKjL7ymZ Kq8VAKlASsF92sKsW4XoajsyyDoic3wxHDgNTlkaYH8tGKI9zrMIvlnIQXWihAupZSLl E+9NT/8viwjFP28QL7wLBHW8tFc13QWgV5ElrdMspTgfko5jFMsamcK7hzA7aMNaczyd ylxrbfVruto6dqBxvkvs0ReuLf9eJp/Ycxw+8OJQX10sBZcROxmvTjRbAkn48e8U8CEX tzwo6CdonOjZBFWBLd0th63J6O45RcaNqSLBVmnzvXgEK7A2Faz4DieQH6642ZJZbZBS vf2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fLyWFvR8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e9-20020a1709062d4900b0073dce13c643si9823621eji.872.2022.09.06.17.47.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 17:47:32 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fLyWFvR8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFF1A383E057 for ; Wed, 7 Sep 2022 00:46:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFF1A383E057 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662511593; bh=b4uZcVb1yB1//IU5rEE8/SASvFhEs8GgdRtORueOyJM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=fLyWFvR81wujsadFlKDWNn2A56qFocHN07WjfVnMRK0nRtkW0e6n44htSiaKIL5je pUVZUG7OY01WV0Nces7GUL9jo+6hueOkVBsLSJPY+AOGj9Y3Znq4E66XGcRYgUTGLE jE2KfLV5cJwGh9yABmw/VEGu5HzAQtombWTvteNQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B2BC63858428 for ; Wed, 7 Sep 2022 00:45:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2BC63858428 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-112-e4zD4v9iPXGH1hmZnS9ueA-1; Tue, 06 Sep 2022 20:45:47 -0400 X-MC-Unique: e4zD4v9iPXGH1hmZnS9ueA-1 Received: by mail-qt1-f198.google.com with SMTP id ci6-20020a05622a260600b0034370b6f5d6so10564696qtb.14 for ; Tue, 06 Sep 2022 17:45:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=b4uZcVb1yB1//IU5rEE8/SASvFhEs8GgdRtORueOyJM=; b=4G2/9T/AAU7jreroKKnAUgpckKEV4Mz9xYwH3zT2CgdQgpApKzUyPf4YxYC4oLuBRj 0dqeGnjOjzETjoUqrSFbKmGv61G2FlM8/Lz0p8nK1EzAVutgOuDnesARTfFXnQpGnVhl BTfgk1KmoCRXnuPIi9eVCeOJeqePsczN28E+rj70adO1Y8+LSaBebIU452I521ecGhHX ybYFNmIzTVC+snoozLjhX5Mu9IVuYVxCELGK6kTSUXSgOXoteLuEmnGqwUUosM51prGQ m3ORCjE3RxdAzEii/NuUyq0oEQQ/U8AmRY/2nu58Twwabfny50d2iGEyJ8k2U8qjbmPI Jvjw== X-Gm-Message-State: ACgBeo3MccU1hnwL/1+q8QfWquGNYGtbucJ2H1iJ9OcJY52i6FhmIiOu u2BOKRifiA5+OSQN5yJ9GOhRl5ywWyP88uiM5E7pf43Jt0Zd1e86NED8Od2Pt6vvo44etbOmIMZ g9kcMSZbHeMTAMDbytFV5oGOvVOEASqx69aGERAoYfKrYu/pukPzJBI2eQlYjgK+C+OI= X-Received: by 2002:a05:620a:454b:b0:6bb:63e1:7456 with SMTP id u11-20020a05620a454b00b006bb63e17456mr1058620qkp.328.1662511546775; Tue, 06 Sep 2022 17:45:46 -0700 (PDT) X-Received: by 2002:a05:620a:454b:b0:6bb:63e1:7456 with SMTP id u11-20020a05620a454b00b006bb63e17456mr1058608qkp.328.1662511546472; Tue, 06 Sep 2022 17:45:46 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f1-20020a05620a408100b006bbd0ae9c05sm13811852qko.130.2022.09.06.17.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 17:45:46 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] libstdc++: Optimize is_void and is_null_pointer Date: Tue, 6 Sep 2022 20:45:41 -0400 Message-Id: <20220907004542.288365-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.3.518.g79f2338b37 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743269818433283069?= X-GMAIL-MSGID: =?utf-8?q?1743269818433283069?= Instead of defining these in terms of a helper class template and the relatively expensive __remove_cv_t, just declare four explicit specializations of the main template, one for each choice of cv-quals. Tested on x86_64-pc-linux-gnu, does this look OK for trunk? The is_void change alone reduces memory usage for join.cc by almost 1%. libstdc++-v3/ChangeLog: * include/std/type_traits (__is_void_helper): Remove. (is_void): Make the primary template derive from false_type, and define four explicit specializations that derive from true_type. (__is_null_pointer_helper, is_null_pointer): Likewise. --- libstdc++-v3/include/std/type_traits | 48 ++++++++++++++++++---------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index e4d167939d9..b83e7257a9f 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -289,23 +289,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // __remove_cv_t (std::remove_cv_t for C++11). template using __remove_cv_t = typename remove_cv<_Tp>::type; + /// @endcond // Primary type categories. - template - struct __is_void_helper + /// is_void + template + struct is_void : public false_type { }; template<> - struct __is_void_helper + struct is_void : public true_type { }; - /// @endcond - /// is_void - template - struct is_void - : public __is_void_helper<__remove_cv_t<_Tp>>::type - { }; + template<> + struct is_void + : public true_type { }; + + template<> + struct is_void + : public true_type { }; + + template<> + struct is_void + : public true_type { }; /// @cond undocumented template @@ -571,19 +578,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #define __cpp_lib_is_null_pointer 201309L - template - struct __is_null_pointer_helper + /// is_null_pointer (LWG 2247). + template + struct is_null_pointer : public false_type { }; template<> - struct __is_null_pointer_helper + struct is_null_pointer : public true_type { }; - /// is_null_pointer (LWG 2247). - template - struct is_null_pointer - : public __is_null_pointer_helper<__remove_cv_t<_Tp>>::type - { }; + template<> + struct is_null_pointer + : public true_type { }; + + template<> + struct is_null_pointer + : public true_type { }; + + template<> + struct is_null_pointer + : public true_type { }; /// __is_nullptr_t (deprecated extension). /// @deprecated Non-standard. Use `is_null_pointer` instead. From patchwork Wed Sep 7 00:45:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp904531wrt; Tue, 6 Sep 2022 17:47:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5O9X6+rOgcmnwhdKU7sVXfqy2piHtmZhyk9z03ZTarj7o2yAJHRWiPic8OYVM2S0hV32i+ X-Received: by 2002:a17:907:b03:b0:742:a5b2:374f with SMTP id h3-20020a1709070b0300b00742a5b2374fmr683484ejl.396.1662511653397; Tue, 06 Sep 2022 17:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662511653; cv=none; d=google.com; s=arc-20160816; b=IyAO3dQnASbwjSYRJMZgdgKPNd8VrL7LGwr60HK2rKkVVpycdpRCiX8Ve5/4ZKlwtl mHmzB0IkgpWwIl2d5nIjmCke1vD7Jl+8L7XjKJRboqQlFpathOZb57mWBJ6Z+Q1sT8U4 fPNdidVzGdLl432YS/hXS9NS+uGVLJYcZzSRFzs4SSBlUzumgEGmvUwDH9y8vzgp4r+Y NcvAF/S3ZXPB2WEjqjJaZSEKW8QiBm5p/0LWzBUh3LZgXtv+/2u86yEbBcn21qKGhlxP waZWhfyX5Ii/SydNXODxhL/hqwz1u1zNX2ncrwLtwFVYw0RLZU9lbI9xtYb3V4cIEQiR WRLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=zLsjmdzYJ5UWxsycrZY82aRiepATS2WhtFcuz/DMovY=; b=YIJGooixOkJt1G18YeB3aA1vdgCqT9B/JVqYKvgszdFqGuC+zrdq/kAmpmP8mcpv1b MEwmLeDelgx3Da9GveZHK5I4ohIE/lCc4rlu97En/H/uRF6OGvBhOn3V5GY/9YZCm1Ql rHeZSKXaE4xUKHYbdf9KC7Cir8j2Mttggr6QtCKfyabh1iFqsWY9y/bdCKi/z4h9irwT S4oqnv6OHeUOFfnns3zkLj3AQeyJw9Lv+lW9LFB3S7QLnNSVdVHHwY6ttwRR+PNNVaaZ c6JbSVGU+XM/kJ3wzL7W+3BB/++CHU/fx8AHUJjO39WKeKq6ur8mfuVgholWH1DpUVyn 0Krw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qOPvyFq3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h4-20020a0564020e8400b0044dbb9afe1fsi7117604eda.467.2022.09.06.17.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 17:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=qOPvyFq3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0035383BD5B for ; Wed, 7 Sep 2022 00:46:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0035383BD5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662511593; bh=zLsjmdzYJ5UWxsycrZY82aRiepATS2WhtFcuz/DMovY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qOPvyFq38BrXl2MrlTNkn9s6BBZOsACyCtv+WzS5dYGcR6gWVazGSessyAn/Gs3Wy 0bOSWSvJJSNEQO9+Z4sSSL4oWH0Dp0mi14ce+Azt6ws7GZRdDpsx4jhdOU53saMSEv kxX+vl6J9c8QzVYyFZPx9KMT3y76MFYXAqA7Bq+I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2DDF73858297 for ; Wed, 7 Sep 2022 00:45:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DDF73858297 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-444-z4Y8Tv_iMLaV_rs2lblrEw-1; Tue, 06 Sep 2022 20:45:49 -0400 X-MC-Unique: z4Y8Tv_iMLaV_rs2lblrEw-1 Received: by mail-qv1-f69.google.com with SMTP id g4-20020ad45424000000b004a9bb302c85so3887696qvt.22 for ; Tue, 06 Sep 2022 17:45:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=zLsjmdzYJ5UWxsycrZY82aRiepATS2WhtFcuz/DMovY=; b=m7MxhmjonW1+Xi0GY5ryxPpWHIIdAOgGPtbw0tNMCoHna8y5sAFYSlRQtrBEGcukQQ e9PT2UNQncOkjAII/ge1TFpiqVRUJ7fNyItdxPVni3QkJfX9H4+CQFTOePhPJ5EDwyuo W59P6XSOODeSe0wQXHaynJqd2ADc/VRBMP+iyUo3WqT6Xpz9eZe2kGiayHAkvqerZc40 7s7gR10Pf5i5szBrUIGYRx06qIZPxxZLn0oxUgAdifIrcEwsYuoT8dTA8atE9mw/4osj vXUtcg2HtC6TEOhS0F+thL5sV4hz9pcDhi5wFCR6+XkbFKYOLkPQGh3cnQHBFgI6maR7 9UNw== X-Gm-Message-State: ACgBeo0b7EKdvArAhecijKURzWxc3WClShGQAnOePMP/+6/f7jpHghf/ qSIsU6AP1tI3Lr/E4+vWUflJ4PkB7SR72bqiJ9kDd1wGXZ0Y9DN3hzuCVTvGcZdLwqLX5zM/tG0 I7rfzXr7shksbEJsS8hWu69Dp63Gq0snu/8vd5yTarHGOpHCzUT3ubEta5imsa9RN4OY= X-Received: by 2002:ac8:6c4:0:b0:355:8fd:21a0 with SMTP id j4-20020ac806c4000000b0035508fd21a0mr1196608qth.235.1662511548336; Tue, 06 Sep 2022 17:45:48 -0700 (PDT) X-Received: by 2002:ac8:6c4:0:b0:355:8fd:21a0 with SMTP id j4-20020ac806c4000000b0035508fd21a0mr1196587qth.235.1662511548063; Tue, 06 Sep 2022 17:45:48 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f1-20020a05620a408100b006bbd0ae9c05sm13811852qko.130.2022.09.06.17.45.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 17:45:47 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] libstdc++: Optimize is_reference Date: Tue, 6 Sep 2022 20:45:42 -0400 Message-Id: <20220907004542.288365-2-ppalka@redhat.com> X-Mailer: git-send-email 2.37.3.518.g79f2338b37 In-Reply-To: <20220907004542.288365-1-ppalka@redhat.com> References: <20220907004542.288365-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743269819524898300?= X-GMAIL-MSGID: =?utf-8?q?1743269819524898300?= Instead of defining is_reference in terms of is_lvalue_reference and is_rvalue_reference, just define it directly. Tested on x86_64-pc-linux-gnu, does this look OK for trunk? This reduces memory usage of join.cc by 1%. libstdc++-v3/ChangeLog: * include/std/type_traits (is_reference): Make the primary template derive from false_type. Define two partial specializations that derive from true_type. --- libstdc++-v3/include/std/type_traits | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index b83e7257a9f..94e73eafd2f 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -611,8 +611,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_reference template struct is_reference - : public __or_, - is_rvalue_reference<_Tp>>::type + : public false_type + { }; + + template + struct is_reference<_Tp&> + : public true_type + { }; + + template + struct is_reference<_Tp&&> + : public true_type { }; /// is_arithmetic