diff options
| author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-18 02:58:06 +0000 |
|---|---|---|
| committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-18 02:58:06 +0000 |
| commit | e6014a82ae8a4aec4fb4bee768401c7da3549d97 (patch) | |
| tree | 025d5854011b99cfe93205d711317cfd2947da24 /libstdc++-v3/include/tr2 | |
| parent | 05d36c46715e8b9ad4692b7c91da4594cf0d9826 (diff) | |
| download | ppe42-gcc-e6014a82ae8a4aec4fb4bee768401c7da3549d97.tar.gz ppe42-gcc-e6014a82ae8a4aec4fb4bee768401c7da3549d97.zip | |
2011-10-17 Michael Spertus <mike_spertus@symantec.com>
* gcc/c-family/c-common.c (c_common_reswords): Add __bases,
__direct_bases.
* gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES.
2011-10-17 Michael Spertus <mike_spertus@symantec.com>
* cp-tree.def: Add BASES as a new tree code.
* cp-tree.h (enum cp_trait_kind): Add CPTK_BASES, CPTK_DIRECT_BASES.
(BASES_TYPE, BASES_DIRECT): Define.
(calculate_bases, finish_bases, calculate_direct_bases): Declare.
* parser.c (cp_parser_trait_expr, cp_parser_template_argument_list,
(cp_parser_simple_type_specifier, cp_parser_save_nsdmi): Use them.
* pt.c (find_parameter_packs_r, tsubst_pack_expansion): Likewise.
* semantics.c (calculate_bases, finish_bases, calculate_direct_bases,
dfs_calculate_bases_pre, dfs_calculate_bases_post,
calculate_bases_helper): Define.
2011-10-17 Michael Spertus <mike_spertus@symantec.com>
* g++.dg/ext/bases.C: New test.
2011-10-17 Michael Spertus <mike_spertus@symantec.com>
* include/tr2/type_traits (bases, direct_bases, typelist): New.
2011-10-17 Benjamin Kosnik <bkoz@redhat.com>
* libstdc++-v3/include/Makefile.am: Add tr2 directory and includes.
* libstdc++-v3/include/Makefile.in: Regenerate.
* scripts/create_testsuite_files: Search tr2 directory.
* testsuite/libstdc++-dg/conformance.exp: Same.
* testsuite/tr2/bases/requirements/explicit_instantiation.cc: New.
* testsuite/tr2/bases/requirements/typedefs.cc: New.
* testsuite/tr2/bases/value.cc: New.
* testsuite/tr2/direct_bases/requirements/
explicit_instantiation.cc: New.
* testsuite/tr2/direct_bases/requirements/typedefs.cc: New.
* testsuite/tr2/direct_bases/value.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180121 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/tr2')
| -rw-r--r-- | libstdc++-v3/include/tr2/type_traits | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits new file mode 100644 index 00000000000..e860ad79bdb --- /dev/null +++ b/libstdc++-v3/include/tr2/type_traits @@ -0,0 +1,102 @@ +// TR2 type_traits -*- C++ -*- + +// Copyright (C) 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 +// <http://www.gnu.org/licenses/>. + +/** @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 <type_traits> +#include <bits/c++config.h> + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace tr2 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup metaprogramming Type Traits + * @ingroup utilities + * + * Compile time type transformation and information. + * @{ + */ + + template<typename... _Elements> + struct typelist; + + template<> + struct typelist<> + { + typedef std::true_type empty; + }; + + template<typename _First, typename... _Rest> + struct typelist<_First, _Rest...> + { + typedef std::false_type empty; + + struct first + { + typedef _First type; + }; + + struct rest + { + typedef typelist<_Rest...> type; + }; + }; + + // Sequence abstraction metafunctions default to looking in the type + template<typename _Tp> + struct first : public _Tp::first { }; + + template<typename _Tp> + struct rest : public _Tp::rest { }; + + template<typename _Tp> + struct empty : public _Tp::empty { }; + + + template<typename _Tp> + struct bases + { + typedef typelist<__bases(_Tp)...> type; + }; + + template<typename _Tp> + struct direct_bases + { + typedef typelist<__direct_bases(_Tp)...> type; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} +} + +#endif // _GLIBCXX_TR2_TYPE_TRAITS |

