RE: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Michael Spertus
:)

> -Original Message-
> From: Jason Merrill [mailto:ja...@redhat.com]
> Sent: Friday, October 14, 2011 2:41 PM
> To: Michael Spertus
> Cc: Benjamin Kosnik; Jonathan Wakely; gcc-patches@gcc.gnu.org;
> libstd...@gcc.gnu.org
> Subject: Re: Intrinsics for N2965: Type traits and base classes
> 
> Looks good, thanks.  I'll let Benjamin check this in.
> 
> Jason


RE: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Michael Spertus
Redo test to run at compile-time per Jason's suggestion

Index: libstdc++-v3/include/tr2/type_traits
===
--- libstdc++-v3/include/tr2/type_traits(revision 0)
+++ libstdc++-v3/include/tr2/type_traits(revision 0)
@@ -0,0 +1,96 @@
+// TR2 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+/** @file tr2/type_traits
+ *  This is a TR2 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR2_TYPE_TRAITS
+#define _GLIBCXX_TR2_TYPE_TRAITS 1
+
+#pragma GCC system_header
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr2
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup metaprogramming Type Traits
+   * @ingroup utilities
+   *
+   * Compile time type transformation and information.
+   * @{
+   */
+
+  template struct typelist;
+  template<>
+struct typelist<>
+{
+  typedef std::true_type empty;
+};
+
+  template
+struct typelist<_First, _Rest...>
+{
+  struct first
+  {
+typedef _First type;
+  };
+
+  struct rest
+  {
+typedef typelist<_Rest...> type;
+  };
+
+  typedef std::false_type empty;
+};
+
+  // Sequence abstraction metafunctions default to looking in the type
+  template struct first : public T::first {};
+  template struct rest : public T::rest {};
+  template struct empty : public T::empty {};
+
+
+  template
+struct bases
+{
+ typedef typelist<__bases(T)...> type;
+};
+
+  template
+struct direct_bases
+{
+  typedef typelist<__direct_bases(T)...> type;
+};
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR2_TYPE_TRAITS
Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 178892)
+++ gcc/c-family/c-common.c (working copy)
@@ -423,6 +423,7 @@
   { "__asm__", RID_ASM,0 },
   { "__attribute", RID_ATTRIBUTE,  0 },
   { "__attribute__",   RID_ATTRIBUTE,  0 },
+  { "__bases",  RID_BASES, D_CXXONLY },
   { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
   { "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
   { "__builtin_offsetof", RID_OFFSETOF, 0 },
@@ -433,6 +434,7 @@
   { "__const", RID_CONST,  0 },
   { "__const__",   RID_CONST,  0 },
   { "__decltype",   RID_DECLTYPE,   D_CXXONLY },
+  { "__direct_bases",   RID_DIRECT_BASES, D_CXXONLY },
   { "__extension__",   RID_EXTENSION,  0 },
   { "__func__",RID_C99_FUNCTION_NAME, 0 },
   { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXXONLY },
Index: gcc/c-family/c-common.h
===
--- gcc/c-family/c-common.h (revision 178892)
+++ gcc/c-family/c-common.h (working copy)
@@ -129,12 +129,13 @@
   RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,

   /* C++ extensions */
+  RID_BASES,  RID_DIRECT_BASES,
   RID_HAS_NOTHROW_ASSIGN,  RID_HAS_NOTHROW_CONSTRUCTOR,
   RID_HAS_NOTHROW_COPY,RID_HAS_TRIVIAL_ASSIGN,
   RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY,
   RID_HAS_TRIVIAL_DESTRUCTOR,  RID_HAS_VIRTUAL_DESTRUCTOR,
   RID_IS_ABSTRACT, RID_IS_BASE_OF,
-  RID_IS_CONVERTIBLE_TO,   RID_IS_CLASS,
+  RID_IS_CLASS,RID_IS_CONVERTIBLE_TO,
   RID_IS_EMPTY,RID_IS_ENUM,
   RID_IS_LITERAL_TYPE, RID_IS_POD,
   RID_IS_POLYMORPHIC,  RID_IS_STD_LAYOUT,
Index: gcc/testsuite/g++.dg/ext/bases.C
===
--- gcc/testsuite/g++.dg/ext/bases.C(revision 0)
+++ gcc/testsuite/g++.dg/ext/bases.C(revision 0)
@@ -0,0 +1,32 @@
+// { dg-do run }
+#include
+#include
+// A simple typelist
+template struct types {};
+
+// Simple bases implementation
+template struct b {
+  typedef types<__bases(T)...> 

RE: Intrinsics for N2965: Type traits and base classes

2011-10-13 Thread Michael Spertus
Addressing Jason's comments:

Index: libstdc++-v3/include/tr2/type_traits
===
--- libstdc++-v3/include/tr2/type_traits(revision 0)
+++ libstdc++-v3/include/tr2/type_traits(revision 0)
@@ -0,0 +1,96 @@
+// TR2 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+/** @file tr2/type_traits
+ *  This is a TR2 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR2_TYPE_TRAITS
+#define _GLIBCXX_TR2_TYPE_TRAITS 1
+
+#pragma GCC system_header
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr2
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup metaprogramming Type Traits
+   * @ingroup utilities
+   *
+   * Compile time type transformation and information.
+   * @{
+   */
+
+  template struct typelist;
+  template<>
+struct typelist<>
+{
+  typedef std::true_type empty;
+};
+
+  template
+struct typelist<_First, _Rest...>
+{
+  struct first
+  {
+typedef _First type;
+  };
+
+  struct rest
+  {
+typedef typelist<_Rest...> type;
+  };
+
+  typedef std::false_type empty;
+};
+
+  // Sequence abstraction metafunctions default to looking in the type
+  template struct first : public T::first {};
+  template struct rest : public T::rest {};
+  template struct empty : public T::empty {};
+
+
+  template
+struct bases
+{
+ typedef typelist<__bases(T)...> type;
+};
+
+  template
+struct direct_bases
+{
+  typedef typelist<__direct_bases(T)...> type;
+};
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR2_TYPE_TRAITS
Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 178892)
+++ gcc/c-family/c-common.c (working copy)
@@ -423,6 +423,7 @@
   { "__asm__", RID_ASM,0 },
   { "__attribute", RID_ATTRIBUTE,  0 },
   { "__attribute__",   RID_ATTRIBUTE,  0 },
+  { "__bases",  RID_BASES, D_CXXONLY },
   { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
   { "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
   { "__builtin_offsetof", RID_OFFSETOF, 0 },
@@ -433,6 +434,7 @@
   { "__const", RID_CONST,  0 },
   { "__const__",   RID_CONST,  0 },
   { "__decltype",   RID_DECLTYPE,   D_CXXONLY },
+  { "__direct_bases",   RID_DIRECT_BASES, D_CXXONLY },
   { "__extension__",   RID_EXTENSION,  0 },
   { "__func__",RID_C99_FUNCTION_NAME, 0 },
   { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXXONLY },
Index: gcc/c-family/c-common.h
===
--- gcc/c-family/c-common.h (revision 178892)
+++ gcc/c-family/c-common.h (working copy)
@@ -129,12 +129,13 @@
   RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,

   /* C++ extensions */
+  RID_BASES,  RID_DIRECT_BASES,
   RID_HAS_NOTHROW_ASSIGN,  RID_HAS_NOTHROW_CONSTRUCTOR,
   RID_HAS_NOTHROW_COPY,RID_HAS_TRIVIAL_ASSIGN,
   RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY,
   RID_HAS_TRIVIAL_DESTRUCTOR,  RID_HAS_VIRTUAL_DESTRUCTOR,
   RID_IS_ABSTRACT, RID_IS_BASE_OF,
-  RID_IS_CONVERTIBLE_TO,   RID_IS_CLASS,
+  RID_IS_CLASS,RID_IS_CONVERTIBLE_TO,
   RID_IS_EMPTY,RID_IS_ENUM,
   RID_IS_LITERAL_TYPE, RID_IS_POD,
   RID_IS_POLYMORPHIC,  RID_IS_STD_LAYOUT,
Index: gcc/testsuite/g++.dg/ext/bases.C
===
--- gcc/testsuite/g++.dg/ext/bases.C(revision 0)
+++ gcc/testsuite/g++.dg/ext/bases.C(revision 0)
@@ -0,0 +1,29 @@
+// { dg-do run }
+#include
+#include
+// A simple typelist
+template struct types {};
+
+// Simple bases implementation
+template struct b {
+  typedef types<__bases(T)...> type;
+};
+
+// Simple dire

RE: Intrinsics for N2965: Type traits and base classes

2011-10-09 Thread Michael Spertus
Here is a new diff that works for non-class types (fixing Benjamin's failing 
test), fixes some spacing and alphabetization, and doesn't inadvertently break 
the __underlying_type trait.

Index: libstdc++-v3/include/tr2/type_traits
===
--- libstdc++-v3/include/tr2/type_traits(revision 0)
+++ libstdc++-v3/include/tr2/type_traits(revision 0)
@@ -0,0 +1,96 @@
+// TR2 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+/** @file tr2/type_traits
+ *  This is a TR2 C++ Library header. 
+ */
+
+#ifndef _GLIBCXX_TR2_TYPE_TRAITS
+#define _GLIBCXX_TR2_TYPE_TRAITS 1
+
+#pragma GCC system_header
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr2
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup metaprogramming Type Traits
+   * @ingroup utilities
+   *
+   * Compile time type transformation and information.
+   * @{
+   */
+
+  template struct typelist;
+  template<>
+struct typelist<>
+{
+  typedef std::true_type empty;
+};
+
+  template
+struct typelist<_First, _Rest...>
+{
+  struct first
+  {
+typedef _First type;
+  };
+
+  struct rest
+  {
+typedef typelist<_Rest...> type;
+  };
+
+  typedef std::false_type empty;
+};
+
+  // Sequence abstraction metafunctions default to looking in the type
+  template struct first : public T::first {};
+  template struct rest : public T::rest {};
+  template struct empty : public T::empty {};
+
+
+  template
+struct bases
+{
+ typedef typelist<__bases(T)...> type;
+};
+
+  template
+struct direct_bases
+{
+  typedef typelist<__direct_bases(T)...> type;
+};
+   
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR2_TYPE_TRAITS
Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 178892)
+++ gcc/c-family/c-common.c (working copy)
@@ -423,6 +423,7 @@
   { "__asm__", RID_ASM,0 },
   { "__attribute", RID_ATTRIBUTE,  0 },
   { "__attribute__",   RID_ATTRIBUTE,  0 },
+  { "__bases",  RID_BASES, D_CXXONLY },
   { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
   { "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
   { "__builtin_offsetof", RID_OFFSETOF, 0 },
@@ -433,6 +434,7 @@
   { "__const", RID_CONST,  0 },
   { "__const__",   RID_CONST,  0 },
   { "__decltype",   RID_DECLTYPE,   D_CXXONLY },
+  { "__direct_bases",   RID_DIRECT_BASES, D_CXXONLY },
   { "__extension__",   RID_EXTENSION,  0 },
   { "__func__",RID_C99_FUNCTION_NAME, 0 },
   { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXXONLY },
Index: gcc/c-family/c-common.h
===
--- gcc/c-family/c-common.h (revision 178892)
+++ gcc/c-family/c-common.h (working copy)
@@ -129,12 +129,13 @@
   RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
 
   /* C++ extensions */
+  RID_BASES,  RID_DIRECT_BASES,
   RID_HAS_NOTHROW_ASSIGN,  RID_HAS_NOTHROW_CONSTRUCTOR,
   RID_HAS_NOTHROW_COPY,RID_HAS_TRIVIAL_ASSIGN,
   RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY,
   RID_HAS_TRIVIAL_DESTRUCTOR,  RID_HAS_VIRTUAL_DESTRUCTOR,
   RID_IS_ABSTRACT, RID_IS_BASE_OF,
-  RID_IS_CONVERTIBLE_TO,   RID_IS_CLASS,
+  RID_IS_CLASS,RID_IS_CONVERTIBLE_TO,  
   RID_IS_EMPTY,RID_IS_ENUM,
   RID_IS_LITERAL_TYPE, RID_IS_POD,
   RID_IS_POLYMORPHIC,  RID_IS_STD_LAYOUT,
Index: gcc/cp/pt.c
===
--- gcc/cp/pt.c (revision 178892)
+++ gcc/cp/pt.c (working copy)
@@ -2976,6 +2976,9 @@
 }
   break;
 
+case BASES:
+  parameter_pack_p = true;
+  br

RE: Intrinsics for N2965: Type traits and base classes

2011-10-02 Thread Michael Spertus
OK. Here is a new diff that hopefully takes into account all of Jason's and 
Benjamin's comments. Benjamin's TR2 build patch is not repeated (or tested!) 
here. Benjamin, I'd really appreciate if you wouldn't mind confirming I handled 
that correctly in tr2/type_traits (Including the inclusion of std/type_traits).

Thanks,

Mike


Index: libstdc++-v3/include/tr2/type_traits
===
--- libstdc++-v3/include/tr2/type_traits(revision 0)
+++ libstdc++-v3/include/tr2/type_traits(revision 0)
@@ -0,0 +1,96 @@
+// TR2 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+/** @file tr2/type_traits
+ *  This is a TR2 C++ Library header. 
+ */
+
+#ifndef _GLIBCXX_TR2_TYPE_TRAITS
+#define _GLIBCXX_TR2_TYPE_TRAITS 1
+
+#pragma GCC system_header
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr2
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup metaprogramming Type Traits
+   * @ingroup utilities
+   *
+   * Compile time type transformation and information.
+   * @{
+   */
+
+  template struct typelist;
+  template<>
+struct typelist<>
+{
+  typedef std::true_type empty;
+};
+
+  template
+struct typelist<_First, _Rest...>
+{
+  struct first
+  {
+typedef _First type;
+  };
+
+  struct rest
+  {
+typedef typelist<_Rest...> type;
+  };
+
+  typedef std::false_type empty;
+};
+
+  // Sequence abstraction metafunctions default to looking in the type
+  template struct first : public T::first {};
+  template struct rest : public T::rest {};
+  template struct empty : public T::empty {};
+
+
+  template
+struct bases
+{
+ typedef typelist<__bases(T)...> type;
+};
+
+  template
+struct direct_bases
+{
+  typedef typelist<__direct_bases(T)...> type;
+};
+   
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR2_TYPE_TRAITS
Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 178892)
+++ gcc/c-family/c-common.c (working copy)
@@ -423,6 +423,7 @@
   { "__asm__", RID_ASM,0 },
   { "__attribute", RID_ATTRIBUTE,  0 },
   { "__attribute__",   RID_ATTRIBUTE,  0 },
+  { "__bases",  RID_BASES, D_CXXONLY },
   { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
   { "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
   { "__builtin_offsetof", RID_OFFSETOF, 0 },
@@ -433,6 +434,7 @@
   { "__const", RID_CONST,  0 },
   { "__const__",   RID_CONST,  0 },
   { "__decltype",   RID_DECLTYPE,   D_CXXONLY },
+  { "__direct_bases",   RID_DIRECT_BASES, D_CXXONLY },
   { "__extension__",   RID_EXTENSION,  0 },
   { "__func__",RID_C99_FUNCTION_NAME, 0 },
   { "__has_nothrow_assign", RID_HAS_NOTHROW_ASSIGN, D_CXXONLY },
Index: gcc/c-family/c-common.h
===
--- gcc/c-family/c-common.h (revision 178892)
+++ gcc/c-family/c-common.h (working copy)
@@ -139,7 +139,8 @@
   RID_IS_LITERAL_TYPE, RID_IS_POD,
   RID_IS_POLYMORPHIC,  RID_IS_STD_LAYOUT,
   RID_IS_TRIVIAL,  RID_IS_UNION,
-  RID_UNDERLYING_TYPE,
+  RID_UNDERLYING_TYPE, RID_BASES,
+  RID_DIRECT_BASES,
 
   /* C++0x */
   RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
Index: gcc/cp/pt.c
===
--- gcc/cp/pt.c (revision 178892)
+++ gcc/cp/pt.c (working copy)
@@ -2976,6 +2976,9 @@
 }
   break;
 
+case BASES:
+  parameter_pack_p = true;
+  break;
 default:
   /* Not a parameter pack.  */
   break;
@@ -9123,6 +9126,15 @@
   tree arg_pack = NULL_TREE;
   tree orig_arg = NULL_TREE;
 
+  if (TREE_CODE (parm_pack)

Re: Intrinsics for N2965: Type traits and base classes

2011-09-27 Thread Michael Spertus
Benjamin,
I think tuple is wrong both for performance reasons (I believe these are likely 
to be serious enough to depress use due to inordinately long compiles) and 
because it prematurely locks us into a rigid choice of how our typelists are 
implemented. 

My inclination is to make it type-independent by returning an unspecified type 
that can have a sequence of types extracted from it (this is the approach taken 
by boost::mpl and has loads of experience that shows it is a good approach to 
metaprogramming). In other words, first>::type would be the first base 
of A, etc. 

I've coded this up, and it seems to work very well without committing us to any 
particular typelist implementation. I don't think it has any downsides relative 
to tuple. I'll do a little benchmarking to compare it to tuple (I suspect it 
will be far faster) and then send to the library list,

Mike

Sent from my iPhone

On Sep 27, 2011, at 9:59 PM, "Benjamin Kosnik"  wrote:

> 
>> This patch consists intrinsics to properly create the bases and 
>> direct_bases of a class in the correct order (including multiple
>> nested ambiguous virtual and non-virtual classes) for N2965 
>> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2965.html). 
>> This allows you to create type traits for giving the base classes of
>> the class:
>> 
>> template
>> struct bases
>> {
>>   typedef tuple<__bases(_Tp)...> type;
>> };
> 
> Cool! So glad to see this.
> 
>> I didn't modify the standard library to include the above type trait
>> in the patch because it is not yet clear what type it should return
>> (e.g., a tuple, a "typelist," something satisfying the requirements
>> of a boost::mpl sequence, or a generalization of parameter packs). I
>> have (cursorily) tested it with the above type trait and the
>> corresponding direct_bases trait.
> 
> OK.
> 
> Here's a patch for the above. What's wrong with tuple? I kind of like
> it seems simple. It's what's in N2965, so let's start there.
> 
> Since it's the first TR2 header, I did the build bits for you. 
> 
> Also, I cc'd the library list. 
> 
> best,
> benjamin
> <20110927-4.patch>