This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] tweak traits for base classes
- From: Benjamin De Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Thu, 1 Mar 2012 23:11:33 -0800
- Subject: [v3] tweak traits for base classes
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 <mike_spertus@symantec.com>
* 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 <type_traits> -*- 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<typename... _Elements>
- 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<typename _First, typename... _Rest>
- 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<typename _Tp>
- struct first : public _Tp::first { };
-
- /// Return the typelist minus the first type.
- template<typename _Tp>
- struct rest : public _Tp::rest { };
-
- /// Query to see if a typelist is empty.
- template<typename _Tp>
- struct empty : public _Tp::empty { };
-
/// Enumerate all the base classes of a class. Form of a typelist.
template<typename _Tp>
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<typename _Tp>
struct direct_bases
{
- typedef typelist<__direct_bases(_Tp)...> type;
+ typedef __reflection_typelist<__direct_bases(_Tp)...> type;
};
/// @} group metaprogramming