From 105c6331b2b4a1e573bf237eaf9c572e18f8147c Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Mon, 18 Sep 2006 13:30:56 +0000 Subject: type_traits.h: New. 2006-09-18 Benjamin Kosnik Peter Doerfler Paolo Carlini * include/ext/type_traits.h: New. (__conditional_type): New. (__numeric_traits): New. (__add_unsigned): New. (__remove_unsigned): New. (__enable_if): New. * include/Makefile.am: Add. * include/Makefile.in: Regenerate. * include/ext/pb_ds/detail/type_utils.hpp: Use ext include, remove duplicates. * include/tr1/hashtable_policy.h (IF): Use __conditional_type. (_Max_digits10): Same. (identity): Use _Identity. (extract1st): Use _Select1st. * include/tr1/random (_Select): Use __conditional_type. (_To_Unsigned_Type): Use __add_unsigned. Linebreak fixups. * include/bits/locale_facets.tcc (__to_unsigned_type): Remove, use __add_unsigned. * include/tr1/random.tcc: Fixups as above. * include/tr1/unordered_map: Same. * include/tr1/hashtable: Same. * include/tr1/unordered_set: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ standard_policies.hpp: Same. * include/ext/pb_ds/detail/standard_policies.hpp: Same. * include/ext/pb_ds/detail/typelist/typelist_filter.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Same. * include/ext/pb_ds/detail/type_utils.hpp: Same. * include/ext/pb_ds/trie_policy.hpp: Same. * docs/html/ext/pb_ds/string_trie_e_access_traits.html: Same. * include/bits/cpp_type_traits.h (__enable_if): Move to ext, make boolean argument first. * include/bits/locale_facets.h: Fixups for __enable_if argument and namespace switch. * include/bits/stl_algobase.h: Same. * include/bits/stl_algo.h: Same. * include/bits/stl_iterator.h: Same. * include/bits/streambuf_iterator.h: Same. * include/debug/safe_iterator.h: Same. * include/tr1/hashtable_policy.h: Same. * include/tr1/cmath: Same. * include/tr1/functional: Same. * include/tr1/functional_iterate.h: Same. * include/std/std_streambuf.h: Same. * include/c_std/std_cmath.h: Same. * testsuite/util/testsuite_tr1.h: Same. * testsuite/util/performance/assoc/multimap_common_type.hpp: Same. Co-Authored-By: Paolo Carlini Co-Authored-By: Peter Doerfler From-SVN: r117024 --- libstdc++-v3/ChangeLog | 53 +++++++ .../ext/pb_ds/string_trie_e_access_traits.html | 4 +- libstdc++-v3/include/Makefile.am | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/include/bits/cpp_type_traits.h | 12 -- libstdc++-v3/include/bits/locale_facets.h | 5 +- libstdc++-v3/include/bits/locale_facets.tcc | 22 +-- libstdc++-v3/include/bits/stl_algo.h | 4 +- libstdc++-v3/include/bits/stl_algobase.h | 15 +- libstdc++-v3/include/bits/stl_iterator.h | 11 +- libstdc++-v3/include/bits/streambuf_iterator.h | 39 +++--- libstdc++-v3/include/c_std/std_cmath.h | 66 +++++---- libstdc++-v3/include/debug/safe_iterator.h | 10 +- .../ext/pb_ds/detail/binary_heap_/binary_heap_.hpp | 4 +- .../gp_hash_table_map_/standard_policies.hpp | 13 +- .../include/ext/pb_ds/detail/standard_policies.hpp | 8 +- .../include/ext/pb_ds/detail/type_utils.hpp | 46 +------ .../ext/pb_ds/detail/typelist/typelist_filter.hpp | 2 +- libstdc++-v3/include/ext/pb_ds/trie_policy.hpp | 6 +- libstdc++-v3/include/ext/type_traits.h | 153 +++++++++++++++++++++ libstdc++-v3/include/std/std_streambuf.h | 16 ++- libstdc++-v3/include/tr1/cmath | 9 +- libstdc++-v3/include/tr1/functional | 2 +- libstdc++-v3/include/tr1/functional_iterate.h | 35 ++--- libstdc++-v3/include/tr1/hashtable | 12 +- libstdc++-v3/include/tr1/hashtable_policy.h | 51 ++----- libstdc++-v3/include/tr1/random | 87 ++++++------ libstdc++-v3/include/tr1/random.tcc | 46 ++----- libstdc++-v3/include/tr1/unordered_map | 16 +-- libstdc++-v3/include/tr1/unordered_set | 20 ++- .../performance/assoc/multimap_common_type.hpp | 4 +- libstdc++-v3/testsuite/util/testsuite_tr1.h | 11 +- 32 files changed, 435 insertions(+), 349 deletions(-) create mode 100644 libstdc++-v3/include/ext/type_traits.h diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5c6ef93..465b785 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,56 @@ +2006-09-18 Benjamin Kosnik + Peter Doerfler + Paolo Carlini + + * include/ext/type_traits.h: New. + (__conditional_type): New. + (__numeric_traits): New. + (__add_unsigned): New. + (__remove_unsigned): New. + (__enable_if): New. + * include/Makefile.am: Add. + * include/Makefile.in: Regenerate. + * include/ext/pb_ds/detail/type_utils.hpp: Use ext include, + remove duplicates. + * include/tr1/hashtable_policy.h (IF): Use __conditional_type. + (_Max_digits10): Same. + (identity): Use _Identity. + (extract1st): Use _Select1st. + * include/tr1/random (_Select): Use __conditional_type. + (_To_Unsigned_Type): Use __add_unsigned. Linebreak fixups. + * include/bits/locale_facets.tcc (__to_unsigned_type): Remove, use + __add_unsigned. + * include/tr1/random.tcc: Fixups as above. + * include/tr1/unordered_map: Same. + * include/tr1/hashtable: Same. + * include/tr1/unordered_set: Same. + * include/ext/pb_ds/detail/gp_hash_table_map_/ + standard_policies.hpp: Same. + * include/ext/pb_ds/detail/standard_policies.hpp: Same. + * include/ext/pb_ds/detail/typelist/typelist_filter.hpp: Same. + * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Same. + * include/ext/pb_ds/detail/type_utils.hpp: Same. + * include/ext/pb_ds/trie_policy.hpp: Same. + * docs/html/ext/pb_ds/string_trie_e_access_traits.html: Same. + + * include/bits/cpp_type_traits.h (__enable_if): Move to ext, make + boolean argument first. + * include/bits/locale_facets.h: Fixups for __enable_if argument + and namespace switch. + * include/bits/stl_algobase.h: Same. + * include/bits/stl_algo.h: Same. + * include/bits/stl_iterator.h: Same. + * include/bits/streambuf_iterator.h: Same. + * include/debug/safe_iterator.h: Same. + * include/tr1/hashtable_policy.h: Same. + * include/tr1/cmath: Same. + * include/tr1/functional: Same. + * include/tr1/functional_iterate.h: Same. + * include/std/std_streambuf.h: Same. + * include/c_std/std_cmath.h: Same. + * testsuite/util/testsuite_tr1.h: Same. + * testsuite/util/performance/assoc/multimap_common_type.hpp: Same. + 2006-09-18 Paolo Carlini PR libstdc++/29063 diff --git a/libstdc++-v3/docs/html/ext/pb_ds/string_trie_e_access_traits.html b/libstdc++-v3/docs/html/ext/pb_ds/string_trie_e_access_traits.html index 19dbedb..58a8be6 100644 --- a/libstdc++-v3/docs/html/ext/pb_ds/string_trie_e_access_traits.html +++ b/libstdc++-v3/docs/html/ext/pb_ds/string_trie_e_access_traits.html @@ -241,12 +241,12 @@ std::allocator<char>
-typename pb_ds::detail::conditional_type<
+typename pb_ds::detail::__conditional_type<
     Reverse,
     typename String::const_reverse_iterator,
     typename String::const_iterator>::type
+"#String349403">String::const_iterator>::__type
 
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 0940be8..7170d84 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -553,6 +553,7 @@ ext_headers = \ ${ext_srcdir}/ropeimpl.h \ ${ext_srcdir}/slist \ ${ext_srcdir}/typelist.h \ + ${ext_srcdir}/type_traits.h \ ${ext_srcdir}/rc_string_base.h \ ${ext_srcdir}/sso_string_base.h \ ${ext_srcdir}/vstring.h \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 51ad224..f112020 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -774,6 +774,7 @@ ext_headers = \ ${ext_srcdir}/ropeimpl.h \ ${ext_srcdir}/slist \ ${ext_srcdir}/typelist.h \ + ${ext_srcdir}/type_traits.h \ ${ext_srcdir}/rc_string_base.h \ ${ext_srcdir}/sso_string_base.h \ ${ext_srcdir}/vstring.h \ diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index a79c1be..e600fcd 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -128,18 +128,6 @@ namespace detail typedef __true_type __type; }; - // Define a nested type if some predicate holds. - template - struct __enable_if - { - }; - - template - struct __enable_if<_Tp, true> - { - typedef _Tp __type; - }; - // Holds if the template-argument is a void type. template struct __is_void diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 6187fbf8..5069a9a 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -2127,7 +2127,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE _ValueT& __v) const; template - typename __enable_if::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type _M_find(const _CharT2*, size_t __len, _CharT2 __c) const { int __ret = -1; @@ -2149,7 +2149,8 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE } template - typename __enable_if::__value>::__type + typename __gnu_cxx::__enable_if::__value, + int>::__type _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const { int __ret = -1; diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 38346b7..3a3fb9a 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -41,6 +41,7 @@ #include // For numeric_limits #include // For bad_cast. #include +#include _GLIBCXX_BEGIN_NAMESPACE(std) @@ -503,20 +504,6 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE _GLIBCXX_END_LDBL_NAMESPACE - template - struct __to_unsigned_type - { typedef _ValueT __type; }; - - template<> - struct __to_unsigned_type - { typedef unsigned long __type; }; - -#ifdef _GLIBCXX_USE_LONG_LONG - template<> - struct __to_unsigned_type - { typedef unsigned long long __type; }; -#endif - _GLIBCXX_BEGIN_LDBL_NAMESPACE template @@ -527,7 +514,8 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE ios_base::iostate& __err, _ValueT& __v) const { typedef char_traits<_CharT> __traits_type; - typedef typename __to_unsigned_type<_ValueT>::__type __unsigned_type; + using __gnu_cxx::__add_unsigned; + typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); @@ -975,6 +963,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep, ios_base&, _CharT* __new, _CharT* __cs, int& __len) const { + using __gnu_cxx::__add_unsigned; _CharT* __p = std::__add_grouping(__new, __sep, __grouping, __grouping_size, __cs, __cs + __len); __len = __p - __new; @@ -987,7 +976,8 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill, _ValueT __v) const { - typedef typename __to_unsigned_type<_ValueT>::__type __unsigned_type; + using __gnu_cxx::__add_unsigned; + typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; typedef __numpunct_cache<_CharT> __cache_type; __use_cache<__cache_type> __uc; const locale& __loc = __io._M_getloc(); diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 04b6154..cf3cd71 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -300,8 +300,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @endif */ template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + istreambuf_iterator<_CharT> >::__type find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT&); diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 9507241..2c603eb 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -319,17 +320,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Helpers for streambuf iterators (either istream or ostream). template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type __copy_aux(_CharT*, _CharT*, ostreambuf_iterator<_CharT>); template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type __copy_aux(const _CharT*, const _CharT*, ostreambuf_iterator<_CharT>); template - typename __enable_if<_CharT*, __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type __copy_aux(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, _CharT*); @@ -405,8 +406,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Overload for streambuf iterators. template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type copy(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, ostreambuf_iterator<_CharT>); diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 7746aa2..f9425aa 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1,6 +1,7 @@ // Iterators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +// 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 @@ -66,6 +67,7 @@ #define _ITERATOR_H 1 #include +#include _GLIBCXX_BEGIN_NAMESPACE(std) @@ -653,10 +655,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // Allow iterator to const_iterator conversion template __normal_iterator(const __normal_iterator<_Iter, - typename std::__enable_if<_Container, - (std::__are_same<_Iter, - typename _Container::pointer>::__value) - >::__type>& __i) + typename __enable_if< + (std::__are_same<_Iter, typename _Container::pointer>::__value), + _Container>::__type>& __i) : _M_current(__i.base()) { } // Forward iterator requirements diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h index 4691531..8c76013 100644 --- a/libstdc++-v3/include/bits/streambuf_iterator.h +++ b/libstdc++-v3/include/bits/streambuf_iterator.h @@ -44,8 +44,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type copy(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, ostreambuf_iterator<_CharT>); @@ -68,20 +68,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) //@} template - friend typename __enable_if, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); template - friend typename __enable_if<_CharT2*, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type __copy_aux(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template - friend typename __enable_if, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); @@ -224,8 +224,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) //@} template - friend typename __enable_if, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, ostreambuf_iterator<_CharT2>); @@ -285,8 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Overloads for streambuf iterators. template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type copy(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, ostreambuf_iterator<_CharT> __result) @@ -302,8 +302,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type __copy_aux(_CharT* __first, _CharT* __last, ostreambuf_iterator<_CharT> __result) { @@ -314,8 +314,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type __copy_aux(const _CharT* __first, const _CharT* __last, ostreambuf_iterator<_CharT> __result) { @@ -326,7 +326,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - typename __enable_if<_CharT*, __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type __copy_aux(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, _CharT* __result) { @@ -360,8 +361,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + istreambuf_iterator<_CharT> >::__type find(istreambuf_iterator<_CharT> __first, istreambuf_iterator<_CharT> __last, const _CharT& __val) { diff --git a/libstdc++-v3/include/c_std/std_cmath.h b/libstdc++-v3/include/c_std/std_cmath.h index 7728faf1..f5036f4 100644 --- a/libstdc++-v3/include/c_std/std_cmath.h +++ b/libstdc++-v3/include/c_std/std_cmath.h @@ -1,6 +1,6 @@ // -*- C++ -*- C forwarding header. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -49,6 +49,7 @@ #include #include +#include #include @@ -107,11 +108,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_acosl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type acos(_Tp __x) - { - return __builtin_acos(__x); - } + { return __builtin_acos(__x); } using ::asin; @@ -124,7 +124,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_asinl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type asin(_Tp __x) { return __builtin_asin(__x); } @@ -139,7 +140,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_atanl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type atan(_Tp __x) { return __builtin_atan(__x); } @@ -154,8 +156,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_atan2l(__y, __x); } template - inline typename __enable_if::__value - && __is_integer<_Up>::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value + && __is_integer<_Up>::__value, + double>::__type atan2(_Tp __y, _Up __x) { return __builtin_atan2(__y, __x); } @@ -170,7 +173,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_ceill(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type ceil(_Tp __x) { return __builtin_ceil(__x); } @@ -185,7 +189,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_cosl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type cos(_Tp __x) { return __builtin_cos(__x); } @@ -200,7 +205,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_coshl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type cosh(_Tp __x) { return __builtin_cosh(__x); } @@ -215,7 +221,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_expl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type exp(_Tp __x) { return __builtin_exp(__x); } @@ -230,7 +237,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_fabsl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type fabs(_Tp __x) { return __builtin_fabs(__x); } @@ -245,7 +253,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_floorl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type floor(_Tp __x) { return __builtin_floor(__x); } @@ -270,7 +279,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_frexpl(__x, __exp); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type frexp(_Tp __x, int* __exp) { return __builtin_frexp(__x, __exp); } @@ -285,7 +295,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_ldexpl(__x, __exp); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type ldexp(_Tp __x, int __exp) { return __builtin_ldexp(__x, __exp); } @@ -300,7 +311,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_logl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type log(_Tp __x) { return __builtin_log(__x); } @@ -315,7 +327,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_log10l(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type log10(_Tp __x) { return __builtin_log10(__x); } @@ -371,7 +384,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_sinl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type sin(_Tp __x) { return __builtin_sin(__x); } @@ -386,7 +400,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_sinhl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type sinh(_Tp __x) { return __builtin_sinh(__x); } @@ -401,7 +416,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_sqrtl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type sqrt(_Tp __x) { return __builtin_sqrt(__x); } @@ -416,7 +432,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_tanl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type tan(_Tp __x) { return __builtin_tan(__x); } @@ -431,7 +448,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return __builtin_tanhl(__x); } template - inline typename __enable_if::__value>::__type + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type tanh(_Tp __x) { return __builtin_tanh(__x); } diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index e49ae09..cd30bf7 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -37,7 +37,7 @@ #include #include #include -#include +#include namespace __gnu_debug { @@ -136,11 +136,9 @@ namespace __gnu_debug template _Safe_iterator( const _Safe_iterator<_MutableIterator, - typename std::__enable_if< - _Sequence, - (std::__are_same<_MutableIterator, - typename _Sequence::iterator::_Base_iterator>::__value) - >::__type>& __x) + typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator, + typename _Sequence::iterator::_Base_iterator>::__value), + _Sequence>::__type>& __x) : _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base()) { _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(), diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp index a47033a..659b773 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp @@ -105,10 +105,10 @@ namespace pb_ds value_allocator; typedef - typename conditional_type< + typename __conditional_type< simple_value, Value_Type, - typename value_allocator::pointer>::type + typename value_allocator::pointer>::__type entry; typedef diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp index 82c5ca0..f4bf7c6 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp @@ -54,10 +54,8 @@ namespace pb_ds { - namespace detail { - template struct default_probe_fn { @@ -66,20 +64,17 @@ namespace pb_ds public: typedef - typename conditional_type< + typename __conditional_type< is_same< pb_ds::direct_mask_range_hashing, Comb_Probe_Fn>::value, - pb_ds::linear_probe_fn< - size_type>, - pb_ds::quadratic_probe_fn< - size_type> >::type + pb_ds::linear_probe_fn, + pb_ds::quadratic_probe_fn >::__type type; }; } // namespace detail - } // namespace pb_ds -#endif // #ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP +#endif diff --git a/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp index 3371388..000e3a4 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp @@ -89,14 +89,14 @@ namespace pb_ds typedef typename Comb_Hash_Fn::size_type size_type; typedef - typename conditional_type< + typename __conditional_type< is_same< pb_ds::direct_mask_range_hashing< size_type>, Comb_Hash_Fn>::value, pb_ds::hash_exponential_size_policy< size_type>, - pb_ds::hash_prime_size_policy>::type + pb_ds::hash_prime_size_policy>::__type size_policy_type; public: @@ -124,14 +124,14 @@ namespace pb_ds public: typedef - typename conditional_type< + typename __conditional_type< is_same< pb_ds::direct_mask_range_hashing, Comb_Probe_Fn>::value, pb_ds::linear_probe_fn< size_type>, pb_ds::quadratic_probe_fn< - size_type> >::type + size_type> >::__type type; }; diff --git a/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp b/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp index 1e2fefa..d66f01c 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp @@ -51,6 +51,7 @@ #include #include #include +#include namespace pb_ds { @@ -74,6 +75,9 @@ namespace pb_ds typedef std::tr1::integral_constant true_type; typedef std::tr1::integral_constant false_type; + using __gnu_cxx::__conditional_type; + using __gnu_cxx::__numeric_traits; + template struct is_const_pointer { @@ -149,53 +153,11 @@ namespace pb_ds }; }; - template struct type_to_type { typedef Type type; }; - - - template - struct conditional_type; - - template - struct conditional_type - { - typedef A type; - }; - - template - struct conditional_type - { - typedef B type; - }; - -#define __glibcxx_signed(T) ((T)(-1) < 0) - -#define __glibcxx_min(T) \ - (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) - -#define __glibcxx_max(T) \ - (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0) - -#define __glibcxx_digits(T) \ - (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) - - template - struct numeric_traits - { - typedef Value value_type; - static const value_type min = __glibcxx_min(value_type); - static const value_type max = __glibcxx_max(value_type); - }; - - template - const Value numeric_traits::min; - - template - const Value numeric_traits::max; } // namespace detail } // namespace pb_ds diff --git a/libstdc++-v3/include/ext/pb_ds/detail/typelist/typelist_filter.hpp b/libstdc++-v3/include/ext/pb_ds/detail/typelist/typelist_filter.hpp index 43e2153..a29facb 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/typelist/typelist_filter.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/typelist/typelist_filter.hpp @@ -72,7 +72,7 @@ namespace detail include_hd = Pred::value }; - typedef typename conditional_type, rest>::type type; + typedef typename __conditional_type, rest>::__type type; }; } // namespace detail diff --git a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp index 3441fd9..d74bed4 100644 --- a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp @@ -72,8 +72,8 @@ namespace pb_ds // Element access traits for string types. template::min, - typename String::value_type Max_E_Val = detail::numeric_traits::max, + typename String::value_type Min_E_Val = detail::__numeric_traits::__min, + typename String::value_type Max_E_Val = detail::__numeric_traits::__max, bool Reverse = false, typename Allocator = std::allocator > struct string_trie_e_access_traits @@ -90,7 +90,7 @@ namespace pb_ds }; // Element const iterator type. - typedef typename detail::conditional_type::type const_iterator; + typedef typename detail::__conditional_type::__type const_iterator; // Element type. typedef typename std::iterator_traits::value_type e_type; diff --git a/libstdc++-v3/include/ext/type_traits.h b/libstdc++-v3/include/ext/type_traits.h new file mode 100644 index 0000000..34e5ebd --- /dev/null +++ b/libstdc++-v3/include/ext/type_traits.h @@ -0,0 +1,153 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 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 2, 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef _EXT_TYPE_TRAITS +#define _EXT_TYPE_TRAITS 1 + +#pragma GCC system_header + +#include +#include +#include +#include // std::streamsize + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + // Define a nested type if some predicate holds. + template + struct __enable_if + { }; + + template + struct __enable_if + { typedef _Tp __type; }; + + // XXX What about std::tr1::true_type? + // Conditional expression for types. If true, first, if false, second. + template + struct __conditional_type + { typedef _Iftrue __type; }; + + template + struct __conditional_type + { typedef _Iffalse __type; }; + + + // Given a builtin type, return the corresponding unsigned type. + template + struct __add_unsigned + { typedef _Value __type; }; + + template<> + struct __add_unsigned + { typedef unsigned char __type; }; + + template<> + struct __add_unsigned + { typedef unsigned short __type; }; + + template<> + struct __add_unsigned + { typedef unsigned int __type; }; + + template<> + struct __add_unsigned + { typedef unsigned long __type; }; + +#ifdef _GLIBCXX_USE_LONG_LONG + template<> + struct __add_unsigned + { typedef unsigned long long __type; }; +#endif + + // Given an builtin type, return the corresponding signed type. + template + struct __remove_unsigned + { typedef _Value __type; }; + + template<> + struct __remove_unsigned + { typedef char __type; }; + + template<> + struct __remove_unsigned + { typedef short __type; }; + + template<> + struct __remove_unsigned + { typedef int __type; }; + + template<> + struct __remove_unsigned + { typedef long __type; }; + +#ifdef _GLIBCXX_USE_LONG_LONG + template<> + struct __remove_unsigned + { typedef long long __type; }; +#endif + + // Compile time constants for builtin types. + // Sadly std::numeric_limits member functions cannot be used for this. +#define __glibcxx_signed(T) ((T)(-1) < 0) +#define __glibcxx_digits(T) (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed(T)) + +#define __glibcxx_min(T) \ + (__glibcxx_signed(T) ? (T)1 << __glibcxx_digits(T) : (T)0) + +#define __glibcxx_max(T) \ + (__glibcxx_signed(T) ? ((T)1 << __glibcxx_digits(T)) - 1 : ~(T)0) + + template + struct __numeric_traits + { + typedef _Value __value_type; + + // Only integer types. + static const __value_type __min = __glibcxx_min(__value_type); + static const __value_type __max = __glibcxx_max(__value_type); + + // Only floating point types. See N1822. + static const std::streamsize __max_digits10 = + 2 + std::numeric_limits<__value_type>::digits * 3010/10000; + }; + + template + const _Value __numeric_traits<_Value>::__min; + + template + const _Value __numeric_traits<_Value>::__max; + + template + const std::streamsize __numeric_traits<_Value>::__max_digits10; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index 40ef0d8..5a5ca86 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -46,6 +46,7 @@ #include #include #include +#include _GLIBCXX_BEGIN_NAMESPACE(std) @@ -60,13 +61,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) basic_streambuf<_CharT, _Traits>*, bool&); template - typename __enable_if<_CharT*, __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type __copy_aux(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, _CharT*); template - typename __enable_if, - __is_char<_CharT>::__value>::__type + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + istreambuf_iterator<_CharT> >::__type find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT&); @@ -166,14 +168,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&); template - friend typename __enable_if<_CharT2*, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type __copy_aux(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, _CharT2*); template - friend typename __enable_if, - __is_char<_CharT2>::__value>::__type + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, const _CharT2&); diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index 0f51604..1b9cc8a 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -371,10 +371,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) namespace detail { template - inline typename - std::__enable_if::__type, - (std::__is_floating<_Tp>::__value - || std::__is_floating<_Up>::__value)>::__type + inline typename __gnu_cxx::__enable_if::__value + || std::__is_floating<_Up>::__value, + typename std::tr1::__promote_2<_Tp, _Up>::__type>::__type atan2(_Tp __y, _Up __x) { typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type; @@ -384,7 +383,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) using std::atan2; using detail::atan2; - + inline float atanh(float __x) { return __builtin_atanhf(__x); } diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional index a8e3d3c..b9afe4b 100644 --- a/libstdc++-v3/include/tr1/functional +++ b/libstdc++-v3/include/tr1/functional @@ -39,7 +39,7 @@ #include "../functional" #include #include -#include +#include #include // for std::tr1::hash #include // for std::abort #include // for std::frexp diff --git a/libstdc++-v3/include/tr1/functional_iterate.h b/libstdc++-v3/include/tr1/functional_iterate.h index c29e341..0b039f9 100644 --- a/libstdc++-v3/include/tr1/functional_iterate.h +++ b/libstdc++-v3/include/tr1/functional_iterate.h @@ -117,12 +117,10 @@ template */ template inline - typename __enable_if< - typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type, - (!is_member_pointer<_Functor>::value - && !is_function<_Functor>::value - && !is_function::type>::value) - >::__type + typename __gnu_cxx::__enable_if<(!is_member_pointer<_Functor>::value + && !is_function<_Functor>::value + && !is_function::type>::value), + typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type>::__type __invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS) { return __f(_GLIBCXX_ARGS); @@ -131,11 +129,10 @@ template #if _GLIBCXX_NUM_ARGS > 0 template inline - typename __enable_if< - typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type, - (is_member_pointer<_Functor>::value - && !is_function<_Functor>::value - && !is_function::type>::value) + typename __gnu_cxx::__enable_if<(is_member_pointer<_Functor>::value + && !is_function<_Functor>::value + && !is_function::type>::value), + typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type >::__type __invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS) { @@ -146,10 +143,9 @@ template // To pick up function references (that will become function pointers) template inline - typename __enable_if< - typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type, - (is_pointer<_Functor>::value - && is_function::type>::value) + typename __gnu_cxx::__enable_if<(is_pointer<_Functor>::value + && is_function::type>::value), + typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type >::__type __invoke(_Functor __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS) { @@ -667,9 +663,7 @@ class function<_Res(_GLIBCXX_TEMPLATE_ARGS)> */ template function(_Functor __f, - typename __enable_if<_Useless, - !is_integral<_Functor>::value>::__type - = _Useless()); + typename __gnu_cxx::__enable_if::value, _Useless>::__type = _Useless()); /** * @brief %Function assignment operator. @@ -723,7 +717,7 @@ class function<_Res(_GLIBCXX_TEMPLATE_ARGS)> * reference_wrapper, this function will not throw. */ template - typename __enable_if::value>::__type + typename __gnu_cxx::__enable_if::value, function&>::__type operator=(_Functor __f) { function(__f).swap(*this); @@ -841,8 +835,7 @@ template template function<_Res(_GLIBCXX_TEMPLATE_ARGS)> ::function(_Functor __f, - typename __enable_if<_Useless, - !is_integral<_Functor>::value>::__type) + typename __gnu_cxx::__enable_if::value, _Useless>::__type) : _Function_base() { typedef _Function_handler<_Signature_type, _Functor> _My_handler; diff --git a/libstdc++-v3/include/tr1/hashtable b/libstdc++-v3/include/tr1/hashtable index 9a682db..47d04eb 100644 --- a/libstdc++-v3/include/tr1/hashtable +++ b/libstdc++-v3/include/tr1/hashtable @@ -347,14 +347,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) // have partial specialization of member templates; it would be // better to just specialize insert on unique_keys. There may be a // cleaner workaround. - typedef typename detail::IF, iterator>::type + typedef typename __gnu_cxx::__conditional_type, iterator>::__type Insert_Return_Type; - typedef typename detail::IF, - detail::identity - >::type + typedef typename __gnu_cxx::__conditional_type, + std::_Identity + >::__type Insert_Conv_Type; node* diff --git a/libstdc++-v3/include/tr1/hashtable_policy.h b/libstdc++-v3/include/tr1/hashtable_policy.h index 57b6e89..076bcce 100644 --- a/libstdc++-v3/include/tr1/hashtable_policy.h +++ b/libstdc++-v3/include/tr1/hashtable_policy.h @@ -34,6 +34,10 @@ #ifndef _TR1_HASHTABLE_POLICY_H #define _TR1_HASHTABLE_POLICY_H 1 +#include // _Identity, _Select1st +#include +#include + namespace std { _GLIBCXX_BEGIN_NAMESPACE(tr1) @@ -41,18 +45,6 @@ namespace detail { namespace { - // General utilities. - template - struct IF; - - template - struct IF - { typedef IfTrue type; }; - - template - struct IF - { typedef IfFalse type; }; - // Helper function: return distance(first, last) for forward // iterators, or 0 for input iterators. template @@ -233,9 +225,9 @@ namespace : public node_iterator_base { typedef Value value_type; - typedef typename IF::type + typedef typename __gnu_cxx::__conditional_type::__type pointer; - typedef typename IF::type + typedef typename __gnu_cxx::__conditional_type::__type reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; @@ -370,9 +362,9 @@ namespace : public hashtable_iterator_base { typedef Value value_type; - typedef typename IF::type + typedef typename __gnu_cxx::__conditional_type::__type pointer; - typedef typename IF::type + typedef typename __gnu_cxx::__conditional_type::__type reference; typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; @@ -465,25 +457,6 @@ namespace // Many of class template hashtable's template parameters are policy // classes. These are defaults for the policies. - // The two key extraction policies used by the *set and *map variants. - // XXX pb_ds::type_to_type - template - struct identity - { - const T& - operator()(const T& t) const - { return t; } - }; - - // XXX use std::_Select1st? - template - struct extract1st - { - const typename Pair::first_type& - operator()(const Pair& p) const - { return p.first; } - }; - // Default range hashing function: use division to fold a large number // into the range [0, N). struct mod_range_hashing @@ -624,13 +597,13 @@ namespace struct map_base { }; template - struct map_base, false, Hashtable> + struct map_base, false, Hashtable> { typedef typename Pair::second_type mapped_type; }; template - struct map_base, true, Hashtable> + struct map_base, true, Hashtable> { typedef typename Pair::second_type mapped_type; @@ -639,8 +612,8 @@ namespace }; template - typename map_base, true, Hashtable>::mapped_type& - map_base, true, Hashtable>:: + typename map_base, true, Hashtable>::mapped_type& + map_base, true, Hashtable>:: operator[](const K& k) { Hashtable* h = static_cast(this); diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random index 8ffdf16..b926c5b 100644 --- a/libstdc++-v3/include/tr1/random +++ b/libstdc++-v3/include/tr1/random @@ -37,7 +37,6 @@ #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include #include #include +#include namespace std { @@ -64,17 +64,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) */ namespace { - // Type selectors -- are these already implemented elsewhere? - template - struct _Select - { typedef _TpTrue _Type; }; - - template - struct _Select - { typedef _TpFalse _Type; }; - - template::digits> + template::digits> struct _Shift { static const _UIntType __value = 0; }; @@ -92,11 +83,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __mod(_Tp __x) { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); } - template - struct _To_Unsigned_Type; - - typedef _Select<(sizeof(unsigned) == 4), - unsigned, unsigned long>::_Type _UInt32Type; + typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4), + unsigned, unsigned long>::__type _UInt32Type; } // anonymous namespace /* @@ -193,9 +181,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) typedef typename _Dist::result_type result_type; // tr1:5.1.1 table 5.1 requirement - typedef typename std::__enable_if::value - >::__type _IsValidType; + typedef typename __gnu_cxx::__enable_if< + is_arithmetic::value, result_type>::__type _IsValidType; public: /** @@ -277,20 +264,19 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @addtogroup tr1_random_generators Random Number Generators * @ingroup tr1_random * - * These classes define objects which provide random or pseudorandom numbers, - * either from a discrete or a continuous interval. The random number - * generator supplied as a part of this library are all uniform random number - * generators which provide a sequence of random number uniformly distributed - * over their range. + * These classes define objects which provide random or pseudorandom + * numbers, either from a discrete or a continuous interval. The + * random number generator supplied as a part of this library are + * all uniform random number generators which provide a sequence of + * random number uniformly distributed over their range. * - * A number generator is a function object with an operator() that takes zero - * arguments and returns a number. + * A number generator is a function object with an operator() that + * takes zero arguments and returns a number. * - * A compliant random number generator must satisy the following requirements. - * + * A compliant random number generator must satisy the following + * requirements.
* - * - *
Random Number Generator Requirements
To be documented.
+ * To be documented. * * @{ */ @@ -704,8 +690,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * This is a model of a Generalized Fibonacci discrete random number * generator, sometimes referred to as the SWC generator. * - * A discrete random number generator that produces pseudorandom numbers using - * @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m @f$. + * A discrete random number generator that produces pseudorandom + * numbers using @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} - + * carry_{i-1}) \bmod m @f$. * * The size of the state is @f$ r @f$ * and the maximum period of the generator is @f$ m^r - m^s -1 @f$. @@ -777,13 +764,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /** * Seeds the initial state @f$ x_0 @f$ of the random number generator. * - * N1688[4.19] modifies this as follows. - * If @p __value == 0, sets value to 19780503. In any case, with a linear + * N1688[4.19] modifies this as follows. If @p __value == 0, + * sets value to 19780503. In any case, with a linear * congruential generator lcg(i) having parameters @f$ m_{lcg} = - * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value @f$, sets - * @f$ x_{-r} \dots x_{-1} @f$ to - * @f$ lcg(1) \bmod m \dots lcg(r) \bmod m @f$ respectively. - * If @f$ x_{-1} = 0 @f$ set carry to 1, otherwise sets carry to 0. + * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value + * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m + * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$ + * set carry to 1, otherwise sets carry to 0. */ void seed(unsigned long __value = 19780503); @@ -893,7 +880,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) seed(_Gen& __g, false_type); private: - typedef typename _To_Unsigned_Type<_IntType>::_Type _UIntType; + typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType; _UIntType _M_x[long_lag]; _UIntType _M_carry; @@ -1014,7 +1001,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * Compares two % subtract_with_carry_01 random number generator objects * of the same type for equality. * - * @param __lhs A % subtract_with_carry_01 random number generator object. + * @param __lhs A % subtract_with_carry_01 random number + * generator object. * @param __rhs Another % subtract_with_carry_01 random number generator * object. * @@ -1035,7 +1023,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * Compares two % subtract_with_carry_01 random number generator objects * of the same type for inequality. * - * @param __lhs A % subtract_with_carry_01 random number generator object. + * @param __lhs A % subtract_with_carry_01 random number + * generator object. + * * @param __rhs Another % subtract_with_carry_01 random number generator * object. * @@ -1376,8 +1366,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) public: /** The type of the generated random value. */ - typedef typename _Select<(sizeof(_Result_type1) > sizeof(_Result_type2)), - _Result_type1, _Result_type2>::_Type result_type; + typedef typename __gnu_cxx::__conditional_type<(sizeof(_Result_type1) > sizeof(_Result_type2)), + _Result_type1, _Result_type2>::__type result_type; // parameter values static const int shift1 = __s1; @@ -1518,8 +1508,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /** - * A standard interface to a platform-specific non-deterministic random number - * generator (if any are available). + * A standard interface to a platform-specific non-deterministic + * random number generator (if any are available). */ class random_device { @@ -2091,7 +2081,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const _RealType& __p = _RealType(0.5)) : _M_t(__t), _M_p(__p), _M_nd() { - _GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0)); + _GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0)); _M_initialize(); } @@ -2355,7 +2345,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) * @p __x from the input stream @p __is. * * @param __is An input stream. - * @param __x A %exponential_distribution random number generator engine. + * @param __x A %exponential_distribution random number + * generator engine. * * @returns The input stream with @p __x extracted or in an error state. */ diff --git a/libstdc++-v3/include/tr1/random.tcc b/libstdc++-v3/include/tr1/random.tcc index a732260..fd052fe 100644 --- a/libstdc++-v3/include/tr1/random.tcc +++ b/libstdc++-v3/include/tr1/random.tcc @@ -86,36 +86,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __calc(_Tp __x) { return __a * __x + __c; } }; - - template - struct _To_Unsigned_Type - { typedef _ValueT _Type; }; - - template<> - struct _To_Unsigned_Type - { typedef unsigned short _Type; }; - - template<> - struct _To_Unsigned_Type - { typedef unsigned int _Type; }; - - template<> - struct _To_Unsigned_Type - { typedef unsigned long _Type; }; - -#ifdef _GLIBCXX_USE_LONG_LONG - template<> - struct _To_Unsigned_Type - { typedef unsigned long long _Type; }; -#endif - - // See N1822. - template - struct _Max_digits10 - { - static const std::streamsize __value = - 2 + std::numeric_limits<_RealType>::digits * 3010/10000; - }; } // anonymous namespace @@ -758,7 +728,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const std::streamsize __precision = __os.precision(); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__os.widen(' ')); - __os.precision(_Max_digits10::__value); + __os.precision(__gnu_cxx::__numeric_traits::__max_digits10); __os << __x.p(); @@ -780,7 +750,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const std::streamsize __precision = __os.precision(); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__os.widen(' ')); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.p(); @@ -932,7 +902,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const _CharT __space = __os.widen(' '); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__space); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.mean() << __space << __x._M_nd; @@ -1156,7 +1126,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const _CharT __space = __os.widen(' '); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__space); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.t() << __space << __x.p() << __space << __x._M_nd; @@ -1195,7 +1165,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const _CharT __space = __os.widen(' '); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__space); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.min() << __space << __x.max(); @@ -1230,7 +1200,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const std::streamsize __precision = __os.precision(); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__os.widen(' ')); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.lambda(); @@ -1292,7 +1262,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const _CharT __space = __os.widen(' '); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__space); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x._M_saved_available << __space << __x.mean() << __space @@ -1418,7 +1388,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const std::streamsize __precision = __os.precision(); __os.flags(std::ios_base::scientific | std::ios_base::left); __os.fill(__os.widen(' ')); - __os.precision(_Max_digits10<_RealType>::__value); + __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10); __os << __x.alpha(); diff --git a/libstdc++-v3/include/tr1/unordered_map b/libstdc++-v3/include/tr1/unordered_map index 6754941..58aaa08 100644 --- a/libstdc++-v3/include/tr1/unordered_map +++ b/libstdc++-v3/include/tr1/unordered_map @@ -50,14 +50,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) bool cache_hash_code = false> class unordered_map : public hashtable, Alloc, - detail::extract1st >, Pred, + std::_Select1st >, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, cache_hash_code, false, true> { typedef hashtable, Alloc, - detail::extract1st >, Pred, + std::_Select1st >, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, @@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const allocator_type& a = allocator_type()) : Base(n, hf, detail::mod_range_hashing(), detail::default_ranged_hash(), - eql, detail::extract1st >(), a) + eql, std::_Select1st >(), a) { } template @@ -88,7 +88,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const allocator_type& a = allocator_type()) : Base (f, l, n, hf, detail::mod_range_hashing(), detail::default_ranged_hash(), - eql, detail::extract1st >(), a) + eql, std::_Select1st >(), a) { } }; @@ -100,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) class unordered_multimap : public hashtable , Alloc, - detail::extract1st >, Pred, + std::_Select1st >, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, @@ -108,7 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) { typedef hashtable , Alloc, - detail::extract1st >, Pred, + std::_Select1st >, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, @@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const allocator_type& a = allocator_type()) : Base (n, hf, detail::mod_range_hashing(), detail::default_ranged_hash(), - eql, detail::extract1st >(), a) + eql, std::_Select1st >(), a) { } @@ -140,7 +140,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const allocator_type& a = allocator_type()) : Base (f, l, n, hf, detail::mod_range_hashing(), detail::default_ranged_hash(), - eql, detail::extract1st >(), a) + eql, std::_Select1st >(), a) { } }; diff --git a/libstdc++-v3/include/tr1/unordered_set b/libstdc++-v3/include/tr1/unordered_set index f3c7227..b537d74 100644 --- a/libstdc++-v3/include/tr1/unordered_set +++ b/libstdc++-v3/include/tr1/unordered_set @@ -50,14 +50,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) bool cache_hash_code = false> class unordered_set : public hashtable, Pred, + std::_Identity, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, cache_hash_code, true, true> { typedef hashtable, Pred, + std::_Identity, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, @@ -76,8 +76,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()) : Base(n, hf, detail::mod_range_hashing(), - detail::default_ranged_hash(), - eql, detail::identity(), a) + detail::default_ranged_hash(), eql, std::_Identity(), a) { } template @@ -87,8 +86,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()) : Base(f, l, n, hf, detail::mod_range_hashing(), - detail::default_ranged_hash(), - eql, detail::identity(), a) + detail::default_ranged_hash(), eql, std::_Identity(), a) { } }; @@ -99,14 +97,14 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) bool cache_hash_code = false> class unordered_multiset : public hashtable , Pred, + std::_Identity, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, cache_hash_code, true, false> { typedef hashtable, Pred, + std::_Identity, Pred, Hash, detail::mod_range_hashing, detail::default_ranged_hash, detail::prime_rehash_policy, @@ -125,8 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()) : Base(n, hf, detail::mod_range_hashing(), - detail::default_ranged_hash(), - eql, detail::identity(), a) + detail::default_ranged_hash(), eql, std::_Identity(), a) { } @@ -137,8 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()) : Base(f, l, n, hf, detail::mod_range_hashing(), - detail::default_ranged_hash(), eql, - detail::identity(), a) + detail::default_ranged_hash(), eql, std::_Identity(), a) { } }; diff --git a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp index 244fb10..51cc3cc 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp @@ -105,12 +105,12 @@ namespace pb_ds { private: typedef - typename pb_ds::detail::conditional_type< + typename pb_ds::detail::__conditional_type< pb_ds::detail::is_same< int, Key>::value, int_hash, - string_hash_fn>::type + string_hash_fn>::__type hash_fn_t; template diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h index 439d435..e478456 100644 --- a/libstdc++-v3/testsuite/util/testsuite_tr1.h +++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h @@ -31,13 +31,12 @@ #ifndef _GLIBCXX_TESTSUITE_TR1_H #define _GLIBCXX_TESTSUITE_TR1_H -#include +#include namespace __gnu_test { // For tr1/type_traits. - template class Category, - typename Type> + template class Category, typename Type> bool test_category(bool value) { @@ -53,8 +52,7 @@ namespace __gnu_test return ret; } - template class Property, - typename Type> + template class Property, typename Type> bool test_property(typename Property::value_type value) { @@ -183,7 +181,8 @@ namespace __gnu_test // For use in 8_c_compatibility. template - typename std::__enable_if::__value>::__type + typename __gnu_cxx::__enable_if::value, + bool>::__type check_ret_type(T) { return true; } -- cgit v1.1