From patchwork Fri Mar 2 07:11:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Kosnik X-Patchwork-Id: 144148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4D429B6F9D for ; Fri, 2 Mar 2012 18:12:10 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331277132; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:Mime-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=5fKmL5G41D88O7UMO+PB bu/UhWw=; b=DSMu3mVF3qohyq/uj/lpQrDqmyE01swRktaqIi5hnOwpYMw3/n+1 RcTK0qwNHt5o5fewV4XR6W91L/fnQ8L3zXeaMBotUSd64lbmHRlJw8A2aZoqtlK6 bZ4ZQqG7uklQJUo8a91sosudlPfuA7QYIzKsaw1CAo0fvxL/lu84nUM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:Mime-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=DomzOFAw5DVbIzmvD/Jkm99Elveha2qgWT1nOAautOSATwkBEF/PaG4rA1GqX2 PBG0Ri6KOeShB8ROtnZNokY/Fb1FSLGMyDWY4TGHo1dUDeUg/y5z496c2Hnj2jth fbC2sDF+c9c39ZI/ozpHS4ZDlvBKVv5sm85sX70ElKUF8=; Received: (qmail 13440 invoked by alias); 2 Mar 2012 07:11:56 -0000 Received: (qmail 13408 invoked by uid 22791); 2 Mar 2012 07:11:53 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Mar 2012 07:11:35 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q227BZFd030618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Mar 2012 02:11:35 -0500 Received: from adair ([10.3.113.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q227BY0O000977; Fri, 2 Mar 2012 02:11:34 -0500 Date: Thu, 1 Mar 2012 23:11:33 -0800 From: Benjamin De Kosnik To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [v3] tweak traits for base classes Message-ID: <20120301231133.627cd3fb@adair> Mime-Version: 1.0 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 After discussions in Kona, some suggestions to refine this trait were proposed, as attached. In addition, there is some documentation which will be checked in later. tested x86/linux -benjamin 2012-03-01 Michael Spertus * include/tr2/type_traits (typelist): To __reflection_typelist. (first, rest, empty): Remove. diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits index 9c301b3..eb8c012 100644 --- a/libstdc++-v3/include/tr2/type_traits +++ b/libstdc++-v3/include/tr2/type_traits @@ -1,6 +1,6 @@ // TR2 -*- C++ -*- -// Copyright (C) 2011 Free Software Foundation, Inc. +// Copyright (C) 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -53,60 +53,48 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * Simple typelist. Compile-time list of types. */ template - struct typelist; + struct __reflection_typelist; /// Specialization for an empty typelist. template<> - struct typelist<> + struct __reflection_typelist<> { - typedef std::true_type empty; + typedef std::true_type empty; }; /// Partial specialization. template - struct typelist<_First, _Rest...> + struct __reflection_typelist<_First, _Rest...> { - typedef std::false_type empty; + typedef std::false_type empty; struct first { - typedef _First type; + typedef _First type; }; struct rest { - typedef typelist<_Rest...> type; + typedef __reflection_typelist<_Rest...> type; }; }; /// Sequence abstraction metafunctions for manipulating a typelist. - /// Return the first type in a typelist. - template - struct first : public _Tp::first { }; - - /// Return the typelist minus the first type. - template - struct rest : public _Tp::rest { }; - - /// Query to see if a typelist is empty. - template - struct empty : public _Tp::empty { }; - /// Enumerate all the base classes of a class. Form of a typelist. template struct bases { - typedef typelist<__bases(_Tp)...> type; + typedef __reflection_typelist<__bases(_Tp)...> type; }; /// Enumerate all the direct base classes of a class. Form of a typelist. template struct direct_bases { - typedef typelist<__direct_bases(_Tp)...> type; + typedef __reflection_typelist<__direct_bases(_Tp)...> type; }; /// @} group metaprogramming