From patchwork Fri Oct 11 15:50:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1175327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510782-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="uIStXkoO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46qXTx2ZRjz9sNx for ; Sat, 12 Oct 2019 02:50:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=wjemjNULVOfls4/pH/X55KzTHjb2B+wjRMhSh8FL5z4zRmiKIZGB8 A1MGsBkeWoCOFxFh1xqjXd1xLnoiuheSKjVqrU7dJOzCyfiUYH5o5uRIMN81lrnn 79KkzCXaoLhj1FOKToOqDafGGdLU/BCDcqvPJM+QmtjVmm1NvNEXKY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=3/D3hdNGBa49l7N1wHDCvvU/Y1s=; b=uIStXkoOYfhmr2Zld40Q VMm6kEysOVtsVO9OyiCH909pK0puvKO0qndl6KLRLeASrfTSuCU2O7GJOayd/0ic HFbMXA7Iv/PJposur87f7zsOk1Q4gYtpMi79rlPaLqw1J4Hk17NJb0DHZ2KOWA80 VcDcBM0fgpEeT22Bf4kd+YQ= Received: (qmail 126470 invoked by alias); 11 Oct 2019 15:50:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 126454 invoked by uid 89); 11 Oct 2019 15:50:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=type_traits X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2019 15:50:12 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A7AC18C8910; Fri, 11 Oct 2019 15:50:11 +0000 (UTC) Received: from localhost (unknown [10.33.36.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 996BC5D9CA; Fri, 11 Oct 2019 15:50:10 +0000 (UTC) Date: Fri, 11 Oct 2019 16:50:09 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Use __is_same_as for std::is_same and std::is_same_v Message-ID: <20191011155009.GA20051@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.12.1 (2019-06-15) By using the built-in we don't need to match a partial specialization for std::is_same and don't need to instantiate std::is_same at all for uses of std::is_same_v. * include/std/type_traits (is_same): Replace partial specialization by using __is_same_as built-in in primary template. (is_same_v): Use __is_same_as built-in instead of instantiating the is_same trait. Tested x86_64-linux, committed to trunk. commit ee208e530893aeb12b6a9edb1563a4e8ecaea887 Author: Jonathan Wakely Date: Wed Sep 11 21:23:31 2019 +0100 Use __is_same_as for std::is_same and std::is_same_v By using the built-in we don't need to match a partial specialization for std::is_same and don't need to instantiate std::is_same at all for uses of std::is_same_v. * include/std/type_traits (is_same): Replace partial specialization by using __is_same_as built-in in primary template. (is_same_v): Use __is_same_as built-in instead of instantiating the is_same trait. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index dc8a019324d..4de5daa9f06 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1388,13 +1388,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Type relations. /// is_same - template + template struct is_same - : public false_type { }; - - template - struct is_same<_Tp, _Tp> - : public true_type { }; + : public integral_constant + { }; /// is_base_of template @@ -3158,7 +3155,7 @@ template template inline constexpr size_t extent_v = extent<_Tp, _Idx>::value; template - inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; + inline constexpr bool is_same_v = __is_same_as(_Tp, _Up); template inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value; template