diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-31 23:37:56 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-31 23:37:56 +0000 |
commit | c17b0a1c1233bfdedba163adff05feb0e2ffb357 (patch) | |
tree | 324bd2dd4033459fbf3d757935139d54703da05b /libstdc++-v3/include/std | |
parent | 29e62146123eee0248b91ada23a0aa518093b604 (diff) | |
download | gcc-c17b0a1c1233bfdedba163adff05feb0e2ffb357.tar.gz |
2007-05-31 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31426
* include/bits/c++config: Remove namespace association bits
from tr1 to std.
* include/ext/type_traits.h (__promote, __promote2,
__promote3, __promote4): Add.
* include/bits/hashtable.h: New.
* include/bits/functional_hash.h: Likewise.
* include/tr1/hashtable.h: Likewise.
* include/tr1_impl/random: New.
* include/tr1_impl/cinttypes: Likewise.
* include/tr1_impl/cstdlib: Likewise.
* include/tr1_impl/unordered_map: Likewise.
* include/tr1_impl/cstdio: Likewise.
* include/tr1_impl/boost_shared_ptr.h: Likewise.
* include/tr1_impl/cctype: Likewise.
* include/tr1_impl/random.tcc: Likewise.
* include/tr1_impl/tuple: Likewise.
* include/tr1_impl/functional_hash.h: Likewise.
* include/tr1_impl/hashtable: Likewise.
* include/tr1_impl/cmath: Likewise.
* include/tr1_impl/type_traitsfwd.h: Likewise.
* include/tr1_impl/hashtable_policy.h: Likewise.
* include/tr1_impl/cfenv: Likewise.
* include/tr1_impl/unordered_set: Likewise.
* include/tr1_impl/functional: Likewise.
* include/tr1_impl/utility: Likewise.
* include/tr1_impl/complex: Likewise.
* include/tr1_impl/type_traits: Likewise.
* include/tr1_impl/cwchar: Likewise.
* include/tr1_impl/cstdint: Likewise.
* include/tr1_impl/regex: Likewise.
* include/tr1_impl/array: Likewise.
* include/tr1_impl/cwctype: Likewise.
* include/tr1/type_traitsfwd.h: Remove.
* include/tr1/boost_shared_ptr.h: Likewise.
* include/tr1/common.h: Likewise.
* include/tr1/hashtable: Likewise.
* include/tr1/hashtable_policy.h: Likewise.
* include/tr1/random.tcc: Likewise.
* include/c_global/cinttypes: Include tr1_impl/cinttypes.
* include/c_global/cstdlib: Likewise for cstdlib.
* include/c_global/cstdio: Likewise for cstdio.
* include/c_global/cctype: Likewise for cctype.
* include/c_global/cmath: Likewise for cmath.
* include/c_global/cfenv: Likewise for cfenv.
* include/c_global/cwchar: Likewise for cwchar.
* include/c_global/cstdint: Likewise for cstdint.
* include/c_global/cwctype: Likewise for cwctype.
* include/tr1/cinttypes: Likewise for cinttypes.
* include/tr1/cstdlib: Likewise for cstdlib.
* include/tr1/cstdio: Likewise for cstdio.
* include/tr1/cctype: Likewise for cctype.
* include/tr1/cmath: Likewise for cmath.
* include/tr1/cfenv: Likewise for cfenv.
* include/tr1/cwchar: Likewise for cwchar.
* include/tr1/cstdint: Likewise for cstdint.
* include/tr1/cwctype: Likewise for cwctype.
* include/tr1/functional_hash.h: Likewise for functional_hash.
* include/std/tuple: Include tr1_impl/tuple.
* include/std/utility: Likewise for utility.
* include/std/type_traits: Likewise for type_traits.
(is_pod): Just forward to __is_pod.
(has_trivial_default_constructor): Just forward to
__has_trivial_constructor.
(has_trivial_copy_constructor): Just forward to __has_trivial_copy.
(has_trivial_assign): Just forward to __has_trivial_assign.
(has_trivial_destructor): Just forward to __has_trivial_destructor.
(has_nothrow_default_constructor): Just forward to
__has_nothrow_constructor.
(has_nothrow_copy_constructor): Just forward to __has_nothrow_copy.
(has_nothrow_assign): Just forward to __has_nothrow_assign.
(is_base_of): Just forward to __is_base_of.
(is_signed, is_unsigned): Implement according to the C++0x
specifications.
* include/std/memory: Likewise for memory.
* include/std/regex: Likewise for regex.
* include/std/random: Likewise for random.
* include/std/unordered_map: Likewise for unordered_map.
* include/std/unordered_set: Likewise for unordered_set.
* include/std/functional: Likewise for functional.
* include/std/complex: Likewise for complex.
* include/std/array: Likewise for array.
* include/tr1/tuple: Likewise for tuple.
* include/tr1/utility: Likewise for utility.
* include/tr1/type_traits: Likewise for type_traits
* include/tr1/memory: Likewise for memory.
* include/tr1/regex: Likewise for regex.
* include/tr1/random: Likewise for random.
* include/tr1/unordered_map: Likewise for unordered_map.
* include/tr1/unordered_set: Likewise for unordered_set.
* include/tr1/functional: Likewise for functional.
* include/tr1/complex: Likewise for complex.
* include/tr1/array: Likewise for array.
* include/c_global/ctgmath: Tweak.
* include/c_global/cstdarg: Likewise.
* include/c_global/ctime: Likewise.
* include/c_global/climits: Likewise.
* include/c_global/cfloat: Likewise.
* include/c_global/ccomplex: Likewise.
* include/c_global/cstdbool: Likewise.
* include/tr1/poly_laguerre.tcc: Tweak, don't use _GLIBCXX_TR1.
* include/tr1/riemann_zeta.tcc: Likewise.
* include/tr1/beta_function.tcc: Likewise.
* include/tr1/exp_integral.tcc: Likewise.
* include/tr1/hypergeometric.tcc: Likewise.
* include/tr1/modified_bessel_func.tcc: Likewise.
* include/tr1/legendre_function.tcc: Likewise.
* include/tr1/special_function_util.h: Likewise.
* include/tr1/bessel_function.tcc: Likewise.
* include/tr1/poly_hermite.tcc: Likewise.
* include/tr1/ell_integral.tcc: Likewise.
* include/tr1/gamma.tcc: Likewise.
* include/tr1/stdlib.h: Likewise.
* include/tr1/math.h: Likewise.
* include/tr1/complex.h: Minor tweaks.
* include/tr1/wctype.h: Likewise.
* include/tr1/wchar.h: Likewise.
* include/tr1/inttypes.h: Likewise.
* include/tr1/tgmath.h: Likewise.
* include/tr1/cstdbool: Likewise.
* include/tr1/cfloat: Likewise.
* include/tr1/ccomplex: Likewise.
* include/tr1/ctime: Likewise.
* include/tr1/climits: Likewise.
* include/tr1/ctgmath: Likewise.
* include/tr1/cstdarg: Likewise.
* testsuite/tr1/headers.cc: Move...
* testsuite/tr1/headers/all.cc: ... here.
* testsuite/tr1/using_namespace_std_tr1.cc: Move...
* testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: ... here.
* testsuite/tr1/headers/using_namespace_std_tr1.cc ... here.
* testsuite/tr1/headers/c++200x/using_namespace_std_tr1.cc: New.
* testsuite/20_util/tuple/requirements/explicit_instantiation.cc:
Adjust namespace.
* testsuite/20_util/has_nothrow_copy_constructor/value.cc: Adjust to
the C++0x requirements.
* testsuite/20_util/has_nothrow_default_constructor/value.cc: Likewise.
* testsuite/20_util/has_trivial_copy_constructor/value.cc: Likewise.
* testsuite/20_util/has_trivial_default_constructor/value.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
dg-error lines.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc:
Un-xfail.
* testsuite/20_util/is_signed/value.cc: New.
* testsuite/20_util/is_signed/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_signed/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_unsigned/value.cc: Likewise..
* testsuite/20_util/is_unsigned/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_unsigned/requirements/explicit_instantiation.cc:
Likewise.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125244 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r-- | libstdc++-v3/include/std/array | 29 | ||||
-rw-r--r-- | libstdc++-v3/include/std/complex | 45 | ||||
-rw-r--r-- | libstdc++-v3/include/std/functional | 26 | ||||
-rw-r--r-- | libstdc++-v3/include/std/memory | 28 | ||||
-rw-r--r-- | libstdc++-v3/include/std/random | 35 | ||||
-rw-r--r-- | libstdc++-v3/include/std/regex | 36 | ||||
-rw-r--r-- | libstdc++-v3/include/std/tuple | 29 | ||||
-rw-r--r-- | libstdc++-v3/include/std/type_traits | 199 | ||||
-rw-r--r-- | libstdc++-v3/include/std/unordered_map | 33 | ||||
-rw-r--r-- | libstdc++-v3/include/std/unordered_set | 33 | ||||
-rw-r--r-- | libstdc++-v3/include/std/utility | 17 |
11 files changed, 433 insertions, 77 deletions
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 5ca2604655d..691f41cbcd8 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -31,16 +31,33 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_ARRAY -#define _GLIBCXX_ARRAY 1 +#ifndef _GLIBCXX_CXX0X_ARRAY +#define _GLIBCXX_CXX0X_ARRAY 1 #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/array> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <bits/stl_algobase.h> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/array> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/array> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_CXX0X_ARRAY diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 04a6c69ba75..61d3580380e 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -47,6 +47,7 @@ #include <bits/c++config.h> #include <bits/cpp_type_traits.h> +#include <ext/type_traits.h> #include <cmath> #include <sstream> @@ -1508,8 +1509,50 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_END_NAMESPACE +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + // See ext/type_traits.h for the primary template. + template<typename _Tp, typename _Up> + struct __promote_2<std::complex<_Tp>, _Up> + { + public: + typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; + }; + + template<typename _Tp, typename _Up> + struct __promote_2<_Tp, std::complex<_Up> > + { + public: + typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; + }; + + template<typename _Tp, typename _Up> + struct __promote_2<std::complex<_Tp>, std::complex<_Up> > + { + public: + typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type; + }; + +_GLIBCXX_END_NAMESPACE + #ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/complex> +# if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +# endif +# include <type_traits> +# if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/complex> +# else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/complex> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +# endif #endif #endif /* _GLIBCXX_COMPLEX */ diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 33bab643b1f..27e88176400 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -55,7 +55,29 @@ #include <bits/stl_function.h> #ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/functional> +# if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +# endif +# include <cmath> +# include <string> +# include <typeinfo> +# include <ext/type_traits.h> +# include <tuple> +# include <type_traits> +# include <bits/functional_hash.h> +# if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/functional> +# else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/functional> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +# endif #endif -#endif /* _GLIBCXX_FUNCTIONAL */ +#endif // _GLIBCXX_FUNCTIONAL diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory index 28b8d85d0e2..c48a5c3529c 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -60,7 +60,33 @@ #include <bits/stl_raw_storage_iter.h> #ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/memory> +# if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +# endif +# include <exception> // std::exception +# include <new> // std::bad_alloc +# include <typeinfo> // std::type_info in get_deleter +# include <bits/stl_algobase.h> // std::swap +# include <iosfwd> // std::basic_ostream +# include <ext/atomicity.h> +# include <ext/concurrence.h> +# include <bits/functexcept.h> +# include <bits/stl_function.h> // std::less +# include <debug/debug.h> +# include <type_traits> +# if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/boost_shared_ptr.h> +# else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/boost_shared_ptr.h> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +# endif #endif #endif /* _GLIBCXX_MEMORY */ diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random index 6faf5f56506..2fccb606985 100644 --- a/libstdc++-v3/include/std/random +++ b/libstdc++-v3/include/std/random @@ -36,11 +36,38 @@ #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/random> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <string> +#include <iosfwd> +#include <limits> +#include <ext/type_traits.h> +#include <ext/numeric_traits.h> +#include <bits/concept_check.h> +#include <debug/debug.h> +#include <type_traits> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/random> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/random> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_RANDOM diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 4b4e4827c29..5c257181f2e 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -31,16 +31,40 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_REGEX -#define _GLIBCXX_REGEX 1 +#ifndef _GLIBCXX_CXX0X_REGEX +#define _GLIBCXX_CXX0X_REGEX 1 #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/regex> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <algorithm> +#include <bitset> +#include <iterator> +#include <locale> +#include <stdexcept> +#include <string> +#include <vector> +#include <utility> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/regex> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/regex> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_CXX0X_REGEX diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 7ea9aff4c5d..94e7ef5c086 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -31,16 +31,33 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_TUPLE -#define _GLIBCXX_TUPLE 1 +#ifndef _GLIBCXX_CXX0X_TUPLE +#define _GLIBCXX_CXX0X_TUPLE 1 #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/tuple> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <utility> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/tuple> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/tuple> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_CXX0X_TUPLE diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 6806ebc255e..8dbfb562295 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -31,18 +31,159 @@ * This is a Standard C++ Library header. */ -#ifndef _GLIBCXX_TYPE_TRAITS -#define _GLIBCXX_TYPE_TRAITS 1 +#ifndef _GLIBCXX_CXX0X_TYPE_TRAITS +#define _GLIBCXX_CXX0X_TYPE_TRAITS 1 #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/type_traits> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -_GLIBCXX_BEGIN_NAMESPACE(std) +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <cstddef> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/type_traits> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/type_traits> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif + +namespace std +{ + template<typename _Tp, + bool = is_integral<_Tp>::value, + bool = is_floating_point<_Tp>::value> + struct __is_signed_helper + : public false_type { }; + + template<typename _Tp> + struct __is_signed_helper<_Tp, false, true> + : public true_type { }; + + template<typename _Tp> + struct __is_signed_helper<_Tp, true, false> + : public integral_constant<bool, _Tp(-1) < _Tp(0)> + { }; + + template<typename _Tp> + struct is_signed + : public integral_constant<bool, __is_signed_helper<_Tp>::value> + { }; + + template<typename _Tp> + struct is_unsigned + : public integral_constant<bool, (is_arithmetic<_Tp>::value + && !is_signed<_Tp>::value)> + { }; + + template<typename _Tp> + struct is_pod + : public integral_constant<bool, __is_pod(_Tp)> + { }; + + template<typename _Tp> + struct has_trivial_default_constructor + : public integral_constant<bool, __has_trivial_constructor(_Tp)> + { }; + + template<typename _Tp> + struct has_trivial_copy_constructor + : public integral_constant<bool, __has_trivial_copy(_Tp)> + { }; + + template<typename _Tp> + struct has_trivial_assign + : public integral_constant<bool, __has_trivial_assign(_Tp)> + { }; + + template<typename _Tp> + struct has_trivial_destructor + : public integral_constant<bool, __has_trivial_destructor(_Tp)> + { }; + + template<typename _Tp> + struct has_nothrow_default_constructor + : public integral_constant<bool, __has_nothrow_constructor(_Tp)> + { }; + + template<typename _Tp> + struct has_nothrow_copy_constructor + : public integral_constant<bool, __has_nothrow_copy(_Tp)> + { }; + + template<typename _Tp> + struct has_nothrow_assign + : public integral_constant<bool, __has_nothrow_assign(_Tp)> + { }; + + template<typename _Base, typename _Derived> + struct is_base_of + : public integral_constant<bool, __is_base_of(_Base, _Derived)> + { }; + + // XXX FIXME + // The C++0x specifications are different, see N2255. + template<typename _From, typename _To> + struct __is_convertible_simple + : public __sfinae_types + { + private: + static __one __test(_To); + static __two __test(...); + static _From __makeFrom(); + + public: + static const bool __value = sizeof(__test(__makeFrom())) == 1; + }; + + template<typename _Tp> + struct __is_int_or_cref + { + typedef typename remove_reference<_Tp>::type __rr_Tp; + static const bool __value = (is_integral<_Tp>::value + || (is_integral<__rr_Tp>::value + && is_const<__rr_Tp>::value + && !is_volatile<__rr_Tp>::value)); + }; + + template<typename _From, typename _To, + bool = (is_void<_From>::value || is_void<_To>::value + || is_function<_To>::value || is_array<_To>::value + // This special case is here only to avoid warnings. + || (is_floating_point<typename + remove_reference<_From>::type>::value + && __is_int_or_cref<_To>::__value))> + struct __is_convertible_helper + { + // "An imaginary lvalue of type From...". + static const bool __value = (__is_convertible_simple<typename + add_reference<_From>::type, _To>::__value); + }; + + template<typename _From, typename _To> + struct __is_convertible_helper<_From, _To, true> + { static const bool __value = (is_void<_To>::value + || (__is_int_or_cref<_To>::__value + && !is_void<_From>::value)); }; + + template<typename _From, typename _To> + struct is_convertible + : public integral_constant<bool, + __is_convertible_helper<_From, _To>::__value> + { }; + // Define a nested type if some predicate holds. template<bool, typename _Tp = void> @@ -131,7 +272,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Utility for finding the unsigned versions of signed integral types. template<typename _Tp> - struct __make_unsigned; + struct __make_unsigned + { typedef _Tp __type; }; template<> struct __make_unsigned<char> @@ -165,16 +307,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, - bool _IsUnsigned = is_unsigned<_Tp>::value, bool _IsEnum = is_enum<_Tp>::value> struct __make_unsigned_selector; template<typename _Tp> - struct __make_unsigned_selector<_Tp, true, true, false> - { typedef _Tp __type; }; - - template<typename _Tp> - struct __make_unsigned_selector<_Tp, true, false, false> + struct __make_unsigned_selector<_Tp, true, false> { private: typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt; @@ -186,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) }; template<typename _Tp> - struct __make_unsigned_selector<_Tp, false, false, true> + struct __make_unsigned_selector<_Tp, false, true> { private: // GNU enums start with sizeof short. @@ -214,7 +351,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Utility for finding the signed versions of unsigned integral types. template<typename _Tp> - struct __make_signed; + struct __make_signed + { typedef _Tp __type; }; template<> struct __make_signed<char> @@ -248,16 +386,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Select between integral and enum: not possible to be both. template<typename _Tp, bool _IsInt = is_integral<_Tp>::value, - bool _IsSigned = is_signed<_Tp>::value, bool _IsEnum = is_enum<_Tp>::value> struct __make_signed_selector; template<typename _Tp> - struct __make_signed_selector<_Tp, true, true, false> - { typedef _Tp __type; }; - - template<typename _Tp> - struct __make_signed_selector<_Tp, true, false, false> + struct __make_signed_selector<_Tp, true, false> { private: typedef __make_signed<typename remove_cv<_Tp>::type> __signedt; @@ -269,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) }; template<typename _Tp> - struct __make_signed_selector<_Tp, false, false, true> + struct __make_signed_selector<_Tp, false, true> { private: // GNU enums start with sizeof short. @@ -293,25 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Integral, but don't define. template<> struct make_signed<bool>; +} - - template<typename _Tp> - struct has_nothrow_default_constructor - : public integral_constant<bool, is_pod<_Tp>::value> { }; - - template<typename _Tp> - struct has_nothrow_copy_constructor - : public integral_constant<bool, is_pod<_Tp>::value> { }; - - template<typename _Tp> - struct has_trivial_default_constructor - : public integral_constant<bool, is_pod<_Tp>::value> { }; - - template<typename _Tp> - struct has_trivial_copy_constructor - : public integral_constant<bool, is_pod<_Tp>::value> { }; - -_GLIBCXX_END_NAMESPACE - -#endif +#endif // _GLIBCXX_CXX0X_TYPE_TRAITS diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index 9eee766dd0a..016d3eaed21 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -36,11 +36,36 @@ #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/unordered_map> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <cmath> +#include <string> +#include <utility> +#include <algorithm> // lower_bound +#include <bits/allocator.h> +#include <bits/stl_function.h> // equal_to, _Identity, _Select1st +#include <type_traits> +#include <bits/functional_hash.h> +#include <bits/hashtable.h> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/unordered_map> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/unordered_map> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_UNORDERED_MAP diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index d83cfa3663d..dba781682ce 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -36,11 +36,36 @@ #pragma GCC system_header -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/unordered_set> -#else +#ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif -#endif +#if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +#endif + +#include <cmath> +#include <string> +#include <utility> +#include <algorithm> // lower_bound +#include <bits/allocator.h> +#include <bits/stl_function.h> // equal_to, _Identity, _Select1st +#include <type_traits> +#include <bits/functional_hash.h> +#include <bits/hashtable.h> + +#if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/unordered_set> +#else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/unordered_set> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +#endif +#endif // _GLIBCXX_UNORDERED_SET diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index c17b355bcdf..21440e5d90e 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -67,7 +67,22 @@ #include <bits/stl_pair.h> #ifdef __GXX_EXPERIMENTAL_CXX0X__ -# include <tr1/utility> +# if defined(_GLIBCXX_INCLUDE_AS_TR1) +# error C++0x header cannot be included from TR1 header +# endif +# if defined(_GLIBCXX_INCLUDE_AS_CXX0X) +# include <tr1_impl/utility> +# else +# define _GLIBCXX_INCLUDE_AS_CXX0X +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 +# include <tr1_impl/utility> +# undef _GLIBCXX_TR1 +# undef _GLIBCXX_END_NAMESPACE_TR1 +# undef _GLIBCXX_BEGIN_NAMESPACE_TR1 +# undef _GLIBCXX_INCLUDE_AS_CXX0X +# endif #endif #endif /* _GLIBCXX_UTILITY */ |