+2006-09-18 Benjamin Kosnik <bkoz@redhat.com>
+ Peter Doerfler <gcc@pdoerfler.com>
+ Paolo Carlini <pcarlini@suse.de>
+
+ * 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 <pcarlini@suse.de>
PR libstdc++/29063
<td>
<pre>
-<b>typename</b> pb_ds::detail::conditional_type<
+<b>typename</b> pb_ds::detail::__conditional_type<
<a href="#Reverse1686776"><tt>Reverse</tt></a>,
<b>typename</b> <a href=
"#String349403"><tt>String</tt></a>::const_reverse_iterator,
<b>typename</b> <a href=
-"#String349403"><tt>String</tt></a>::const_iterator>::type
+"#String349403"><tt>String</tt></a>::const_iterator>::__type
</pre>
</td>
${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 \
${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 \
typedef __true_type __type;
};
- // Define a nested type if some predicate holds.
- template<typename, bool>
- struct __enable_if
- {
- };
-
- template<typename _Tp>
- struct __enable_if<_Tp, true>
- {
- typedef _Tp __type;
- };
-
// Holds if the template-argument is a void type.
template<typename _Tp>
struct __is_void
_ValueT& __v) const;
template<typename _CharT2>
- typename __enable_if<int, __is_char<_CharT2>::__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;
}
template<typename _CharT2>
- typename __enable_if<int, !__is_char<_CharT2>::__value>::__type
+ typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
+ int>::__type
_M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const
{
int __ret = -1;
#include <limits> // For numeric_limits
#include <typeinfo> // For bad_cast.
#include <bits/streambuf_iterator.h>
+#include <ext/type_traits.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_LDBL_NAMESPACE
- template<typename _ValueT>
- struct __to_unsigned_type
- { typedef _ValueT __type; };
-
- template<>
- struct __to_unsigned_type<long>
- { typedef unsigned long __type; };
-
-#ifdef _GLIBCXX_USE_LONG_LONG
- template<>
- struct __to_unsigned_type<long long>
- { typedef unsigned long long __type; };
-#endif
-
_GLIBCXX_BEGIN_LDBL_NAMESPACE
template<typename _CharT, typename _InIter>
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();
_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;
_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();
* @endif
*/
template<typename _CharT>
- typename __enable_if<istreambuf_iterator<_CharT>,
- __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&);
#include <iosfwd>
#include <bits/stl_pair.h>
#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h>
// Helpers for streambuf iterators (either istream or ostream).
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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 _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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 _CharT>
- 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*);
// Overload for streambuf iterators.
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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>);
// 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
#define _ITERATOR_H 1
#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
// Allow iterator to const_iterator conversion
template<typename _Iter>
__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
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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>);
//@}
template<typename _CharT2>
- friend typename __enable_if<ostreambuf_iterator<_CharT2>,
- __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<typename _CharT2>
- 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<typename _CharT2>
- friend typename __enable_if<istreambuf_iterator<_CharT2>,
- __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&);
//@}
template<typename _CharT2>
- friend typename __enable_if<ostreambuf_iterator<_CharT2>,
- __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>);
// Overloads for streambuf iterators.
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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)
}
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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)
{
}
template<typename _CharT>
- typename __enable_if<ostreambuf_iterator<_CharT>,
- __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)
{
}
template<typename _CharT>
- 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)
{
}
template<typename _CharT>
- typename __enable_if<istreambuf_iterator<_CharT>,
- __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)
{
// -*- 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
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
#include <math.h>
{ return __builtin_acosl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__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;
{ return __builtin_asinl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
asin(_Tp __x)
{ return __builtin_asin(__x); }
{ return __builtin_atanl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
atan(_Tp __x)
{ return __builtin_atan(__x); }
{ return __builtin_atan2l(__y, __x); }
template<typename _Tp, typename _Up>
- inline typename __enable_if<double, __is_integer<_Tp>::__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); }
{ return __builtin_ceill(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
ceil(_Tp __x)
{ return __builtin_ceil(__x); }
{ return __builtin_cosl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
cos(_Tp __x)
{ return __builtin_cos(__x); }
{ return __builtin_coshl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
cosh(_Tp __x)
{ return __builtin_cosh(__x); }
{ return __builtin_expl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
exp(_Tp __x)
{ return __builtin_exp(__x); }
{ return __builtin_fabsl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
fabs(_Tp __x)
{ return __builtin_fabs(__x); }
{ return __builtin_floorl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
floor(_Tp __x)
{ return __builtin_floor(__x); }
{ return __builtin_frexpl(__x, __exp); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
frexp(_Tp __x, int* __exp)
{ return __builtin_frexp(__x, __exp); }
{ return __builtin_ldexpl(__x, __exp); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
ldexp(_Tp __x, int __exp)
{ return __builtin_ldexp(__x, __exp); }
{ return __builtin_logl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log(_Tp __x)
{ return __builtin_log(__x); }
{ return __builtin_log10l(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
log10(_Tp __x)
{ return __builtin_log10(__x); }
{ return __builtin_sinl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
sin(_Tp __x)
{ return __builtin_sin(__x); }
{ return __builtin_sinhl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
sinh(_Tp __x)
{ return __builtin_sinh(__x); }
{ return __builtin_sqrtl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
sqrt(_Tp __x)
{ return __builtin_sqrt(__x); }
{ return __builtin_tanl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
tan(_Tp __x)
{ return __builtin_tan(__x); }
{ return __builtin_tanhl(__x); }
template<typename _Tp>
- inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
tanh(_Tp __x)
{ return __builtin_tanh(__x); }
#include <debug/formatter.h>
#include <debug/safe_base.h>
#include <bits/stl_pair.h>
-#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
namespace __gnu_debug
{
template<typename _MutableIterator>
_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(),
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
namespace pb_ds
{
-
namespace detail
{
-
template<typename Comb_Probe_Fn>
struct default_probe_fn
{
public:
typedef
- typename conditional_type<
+ typename __conditional_type<
is_same<
pb_ds::direct_mask_range_hashing<size_t>,
Comb_Probe_Fn>::value,
- pb_ds::linear_probe_fn<
- size_type>,
- pb_ds::quadratic_probe_fn<
- size_type> >::type
+ pb_ds::linear_probe_fn<size_type>,
+ pb_ds::quadratic_probe_fn<size_type> >::__type
type;
};
} // namespace detail
-
} // namespace pb_ds
-#endif // #ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP
+#endif
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:
public:
typedef
- typename conditional_type<
+ typename __conditional_type<
is_same<
pb_ds::direct_mask_range_hashing<size_t>,
Comb_Probe_Fn>::value,
pb_ds::linear_probe_fn<
size_type>,
pb_ds::quadratic_probe_fn<
- size_type> >::type
+ size_type> >::__type
type;
};
#include <cstddef>
#include <utility>
#include <tr1/type_traits>
+#include <ext/type_traits.h>
namespace pb_ds
{
typedef std::tr1::integral_constant<int, 1> true_type;
typedef std::tr1::integral_constant<int, 0> false_type;
+ using __gnu_cxx::__conditional_type;
+ using __gnu_cxx::__numeric_traits;
+
template<typename T>
struct is_const_pointer
{
};
};
-
template<typename Type>
struct type_to_type
{
typedef Type type;
};
-
-
- template<bool Cond, class A, class B>
- struct conditional_type;
-
- template<typename A, class B>
- struct conditional_type<true, A, B>
- {
- typedef A type;
- };
-
- template<typename A, class B>
- struct conditional_type<false, A, B>
- {
- 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<typename Value>
- 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<typename Value>
- const Value numeric_traits<Value>::min;
-
- template<typename Value>
- const Value numeric_traits<Value>::max;
} // namespace detail
} // namespace pb_ds
include_hd = Pred<Hd>::value
};
- typedef typename conditional_type<include_hd, typelist_chain<Hd, rest>, rest>::type type;
+ typedef typename __conditional_type<include_hd, typelist_chain<Hd, rest>, rest>::__type type;
};
} // namespace detail
// Element access traits for string types.
template<typename String = std::string,
- typename String::value_type Min_E_Val = detail::numeric_traits<typename String::value_type>::min,
- typename String::value_type Max_E_Val = detail::numeric_traits<typename String::value_type>::max,
+ typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
+ typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
bool Reverse = false,
typename Allocator = std::allocator<char> >
struct string_trie_e_access_traits
};
// Element const iterator type.
- typedef typename detail::conditional_type<Reverse, typename String::const_reverse_iterator, typename String::const_iterator>::type const_iterator;
+ typedef typename detail::__conditional_type<Reverse, typename String::const_reverse_iterator, typename String::const_iterator>::__type const_iterator;
// Element type.
typedef typename std::iterator_traits<const_iterator>::value_type e_type;
--- /dev/null
+// -*- 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 <cstddef>
+#include <utility>
+#include <limits>
+#include <iosfwd> // std::streamsize
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Define a nested type if some predicate holds.
+ template<bool, typename>
+ struct __enable_if
+ { };
+
+ template<typename _Tp>
+ struct __enable_if<true, _Tp>
+ { typedef _Tp __type; };
+
+ // XXX What about std::tr1::true_type?
+ // Conditional expression for types. If true, first, if false, second.
+ template<bool _Cond, typename _Iftrue, typename _Iffalse>
+ struct __conditional_type
+ { typedef _Iftrue __type; };
+
+ template<typename _Iftrue, typename _Iffalse>
+ struct __conditional_type<false, _Iftrue, _Iffalse>
+ { typedef _Iffalse __type; };
+
+
+ // Given a builtin type, return the corresponding unsigned type.
+ template<typename _Value>
+ struct __add_unsigned
+ { typedef _Value __type; };
+
+ template<>
+ struct __add_unsigned<char>
+ { typedef unsigned char __type; };
+
+ template<>
+ struct __add_unsigned<short>
+ { typedef unsigned short __type; };
+
+ template<>
+ struct __add_unsigned<int>
+ { typedef unsigned int __type; };
+
+ template<>
+ struct __add_unsigned<long>
+ { typedef unsigned long __type; };
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template<>
+ struct __add_unsigned<long long>
+ { typedef unsigned long long __type; };
+#endif
+
+ // Given an builtin type, return the corresponding signed type.
+ template<typename _Value>
+ struct __remove_unsigned
+ { typedef _Value __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned char>
+ { typedef char __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned short>
+ { typedef short __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned int>
+ { typedef int __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned long>
+ { typedef long __type; };
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template<>
+ struct __remove_unsigned<unsigned long long>
+ { 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<typename _Value>
+ 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<typename _Value>
+ const _Value __numeric_traits<_Value>::__min;
+
+ template<typename _Value>
+ const _Value __numeric_traits<_Value>::__max;
+
+ template<typename _Value>
+ const std::streamsize __numeric_traits<_Value>::__max_digits10;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
#include <bits/localefwd.h>
#include <bits/ios_base.h>
#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
basic_streambuf<_CharT, _Traits>*, bool&);
template<typename _CharT>
- 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 _CharT>
- typename __enable_if<istreambuf_iterator<_CharT>,
- __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&);
__copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&);
template<typename _CharT2>
- 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<typename _CharT2>
- friend typename __enable_if<istreambuf_iterator<_CharT2>,
- __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&);
namespace detail
{
template<typename _Tp, typename _Up>
- inline typename
- std::__enable_if<typename std::tr1::__promote_2<_Tp, _Up>::__type,
- (std::__is_floating<_Tp>::__value
- || std::__is_floating<_Up>::__value)>::__type
+ inline typename __gnu_cxx::__enable_if<std::__is_floating<_Tp>::__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;
using std::atan2;
using detail::atan2;
-
+
inline float
atanh(float __x)
{ return __builtin_atanhf(__x); }
#include "../functional"
#include <typeinfo>
#include <tr1/type_traits>
-#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
#include <string> // for std::tr1::hash
#include <cstdlib> // for std::abort
#include <cmath> // for std::frexp
*/
template<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
inline
- typename __enable_if<
- typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type,
- (!is_member_pointer<_Functor>::value
- && !is_function<_Functor>::value
- && !is_function<typename remove_pointer<_Functor>::type>::value)
- >::__type
+ typename __gnu_cxx::__enable_if<(!is_member_pointer<_Functor>::value
+ && !is_function<_Functor>::value
+ && !is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type>::__type
__invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)
{
return __f(_GLIBCXX_ARGS);
#if _GLIBCXX_NUM_ARGS > 0
template<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
inline
- typename __enable_if<
- typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type,
- (is_member_pointer<_Functor>::value
- && !is_function<_Functor>::value
- && !is_function<typename remove_pointer<_Functor>::type>::value)
+ typename __gnu_cxx::__enable_if<(is_member_pointer<_Functor>::value
+ && !is_function<_Functor>::value
+ && !is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type
>::__type
__invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)
{
// To pick up function references (that will become function pointers)
template<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
inline
- typename __enable_if<
- typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type,
- (is_pointer<_Functor>::value
- && is_function<typename remove_pointer<_Functor>::type>::value)
+ typename __gnu_cxx::__enable_if<(is_pointer<_Functor>::value
+ && is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type
>::__type
__invoke(_Functor __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)
{
*/
template<typename _Functor>
function(_Functor __f,
- typename __enable_if<_Useless,
- !is_integral<_Functor>::value>::__type
- = _Useless());
+ typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, _Useless>::__type = _Useless());
/**
* @brief %Function assignment operator.
* reference_wrapper<F>, this function will not throw.
*/
template<typename _Functor>
- typename __enable_if<function&, !is_integral<_Functor>::value>::__type
+ typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, function&>::__type
operator=(_Functor __f)
{
function(__f).swap(*this);
template<typename _Functor>
function<_Res(_GLIBCXX_TEMPLATE_ARGS)>
::function(_Functor __f,
- typename __enable_if<_Useless,
- !is_integral<_Functor>::value>::__type)
+ typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, _Useless>::__type)
: _Function_base()
{
typedef _Function_handler<_Signature_type, _Functor> _My_handler;
// 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<unique_keys,
- std::pair<iterator, bool>, iterator>::type
+ typedef typename __gnu_cxx::__conditional_type<unique_keys,
+ std::pair<iterator, bool>, iterator>::__type
Insert_Return_Type;
- typedef typename detail::IF<unique_keys,
- detail::extract1st<Insert_Return_Type>,
- detail::identity<Insert_Return_Type>
- >::type
+ typedef typename __gnu_cxx::__conditional_type<unique_keys,
+ std::_Select1st<Insert_Return_Type>,
+ std::_Identity<Insert_Return_Type>
+ >::__type
Insert_Conv_Type;
node*
#ifndef _TR1_HASHTABLE_POLICY_H
#define _TR1_HASHTABLE_POLICY_H 1
+#include <functional> // _Identity, _Select1st
+#include <tr1/utility>
+#include <ext/type_traits.h>
+
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(tr1)
{
namespace
{
- // General utilities.
- template<bool Flag, typename IfTrue, typename IfFalse>
- struct IF;
-
- template<typename IfTrue, typename IfFalse>
- struct IF<true, IfTrue, IfFalse>
- { typedef IfTrue type; };
-
- template <typename IfTrue, typename IfFalse>
- struct IF<false, IfTrue, IfFalse>
- { typedef IfFalse type; };
-
// Helper function: return distance(first, last) for forward
// iterators, or 0 for input iterators.
template<class Iterator>
: public node_iterator_base<Value, cache>
{
typedef Value value_type;
- typedef typename IF<constant_iterators, const Value*, Value*>::type
+ typedef typename __gnu_cxx::__conditional_type<constant_iterators, const Value*, Value*>::__type
pointer;
- typedef typename IF<constant_iterators, const Value&, Value&>::type
+ typedef typename __gnu_cxx::__conditional_type<constant_iterators, const Value&, Value&>::__type
reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
: public hashtable_iterator_base<Value, cache>
{
typedef Value value_type;
- typedef typename IF<constant_iterators, const Value*, Value*>::type
+ typedef typename __gnu_cxx::__conditional_type<constant_iterators, const Value*, Value*>::__type
pointer;
- typedef typename IF<constant_iterators, const Value&, Value&>::type
+ typedef typename __gnu_cxx::__conditional_type<constant_iterators, const Value&, Value&>::__type
reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
// 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<typename T>
- struct identity
- {
- const T&
- operator()(const T& t) const
- { return t; }
- };
-
- // XXX use std::_Select1st?
- template<typename Pair>
- 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
struct map_base { };
template<typename K, typename Pair, typename Hashtable>
- struct map_base<K, Pair, extract1st<Pair>, false, Hashtable>
+ struct map_base<K, Pair, std::_Select1st<Pair>, false, Hashtable>
{
typedef typename Pair::second_type mapped_type;
};
template<typename K, typename Pair, typename Hashtable>
- struct map_base<K, Pair, extract1st<Pair>, true, Hashtable>
+ struct map_base<K, Pair, std::_Select1st<Pair>, true, Hashtable>
{
typedef typename Pair::second_type mapped_type;
};
template<typename K, typename Pair, typename Hashtable>
- typename map_base<K, Pair, extract1st<Pair>, true, Hashtable>::mapped_type&
- map_base<K, Pair, extract1st<Pair>, true, Hashtable>::
+ typename map_base<K, Pair, std::_Select1st<Pair>, true, Hashtable>::mapped_type&
+ map_base<K, Pair, std::_Select1st<Pair>, true, Hashtable>::
operator[](const K& k)
{
Hashtable* h = static_cast<Hashtable*>(this);
#include <algorithm>
#include <bits/concept_check.h>
-#include <bits/cpp_type_traits.h>
#include <cmath>
#include <debug/debug.h>
#include <iterator>
#include <tr1/type_traits>
#include <tr1/cmath>
#include <fstream>
+#include <ext/type_traits.h>
namespace std
{
*/
namespace
{
- // Type selectors -- are these already implemented elsewhere?
- template<bool, typename _TpTrue, typename _TpFalse>
- struct _Select
- { typedef _TpTrue _Type; };
-
- template<typename _TpTrue, typename _TpFalse>
- struct _Select<false, _TpTrue, _TpFalse>
- { typedef _TpFalse _Type; };
-
- template<typename _UIntType, int __w, bool =
- __w < std::numeric_limits<_UIntType>::digits>
+ template<typename _UIntType, int __w,
+ bool = __w < std::numeric_limits<_UIntType>::digits>
struct _Shift
{ static const _UIntType __value = 0; };
__mod(_Tp __x)
{ return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
- template<typename _ValueT>
- 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
/*
typedef typename _Dist::result_type result_type;
// tr1:5.1.1 table 5.1 requirement
- typedef typename std::__enable_if<result_type,
- is_arithmetic<result_type>::value
- >::__type _IsValidType;
+ typedef typename __gnu_cxx::__enable_if<
+ is_arithmetic<result_type>::value, result_type>::__type _IsValidType;
public:
/**
* @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.
- * <table border=1 cellpadding=10 cellspacing=0>
+ * A compliant random number generator must satisy the following
+ * requirements. <table border=1 cellpadding=10 cellspacing=0>
* <caption align=top>Random Number Generator Requirements</caption>
- * <tr><td>To be documented.</td></tr>
- * </table>
+ * <tr><td>To be documented.</td></tr> </table>
*
* @{
*/
* 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$.
/**
* 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);
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;
* 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.
*
* 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.
*
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;
/**
- * 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
{
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();
}
* @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.
*/
__calc(_Tp __x)
{ return __a * __x + __c; }
};
-
- template<typename _ValueT>
- struct _To_Unsigned_Type
- { typedef _ValueT _Type; };
-
- template<>
- struct _To_Unsigned_Type<short>
- { typedef unsigned short _Type; };
-
- template<>
- struct _To_Unsigned_Type<int>
- { typedef unsigned int _Type; };
-
- template<>
- struct _To_Unsigned_Type<long>
- { typedef unsigned long _Type; };
-
-#ifdef _GLIBCXX_USE_LONG_LONG
- template<>
- struct _To_Unsigned_Type<long long>
- { typedef unsigned long long _Type; };
-#endif
-
- // See N1822.
- template<typename _RealType>
- struct _Max_digits10
- {
- static const std::streamsize __value =
- 2 + std::numeric_limits<_RealType>::digits * 3010/10000;
- };
} // anonymous namespace
const std::streamsize __precision = __os.precision();
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__os.widen(' '));
- __os.precision(_Max_digits10<double>::__value);
+ __os.precision(__gnu_cxx::__numeric_traits<double>::__max_digits10);
__os << __x.p();
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();
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;
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;
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();
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();
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
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();
bool cache_hash_code = false>
class unordered_map
: public hashtable<Key, std::pair<const Key, T>, Alloc,
- detail::extract1st<std::pair<const Key, T> >, Pred,
+ std::_Select1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, false, true>
{
typedef hashtable<Key, std::pair<const Key, T>, Alloc,
- detail::extract1st<std::pair<const Key, T> >, Pred,
+ std::_Select1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
const allocator_type& a = allocator_type())
: Base(n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
- eql, detail::extract1st<std::pair<const Key, T> >(), a)
+ eql, std::_Select1st<std::pair<const Key, T> >(), a)
{ }
template<typename InputIterator>
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
- eql, detail::extract1st<std::pair<const Key, T> >(), a)
+ eql, std::_Select1st<std::pair<const Key, T> >(), a)
{ }
};
class unordered_multimap
: public hashtable <Key, std::pair<const Key, T>,
Alloc,
- detail::extract1st<std::pair<const Key, T> >, Pred,
+ std::_Select1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
{
typedef hashtable <Key, std::pair<const Key, T>,
Alloc,
- detail::extract1st<std::pair<const Key, T> >, Pred,
+ std::_Select1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
const allocator_type& a = allocator_type())
: Base (n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
- eql, detail::extract1st<std::pair<const Key, T> >(), a)
+ eql, std::_Select1st<std::pair<const Key, T> >(), a)
{ }
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
- eql, detail::extract1st<std::pair<const Key, T> >(), a)
+ eql, std::_Select1st<std::pair<const Key, T> >(), a)
{ }
};
bool cache_hash_code = false>
class unordered_set
: public hashtable<Value, Value, Alloc,
- detail::identity<Value>, Pred,
+ std::_Identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, true>
{
typedef hashtable<Value, Value, Alloc,
- detail::identity<Value>, Pred,
+ std::_Identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
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<Value>(), a)
+ detail::default_ranged_hash(), eql, std::_Identity<Value>(), a)
{ }
template<typename InputIterator>
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<Value>(), a)
+ detail::default_ranged_hash(), eql, std::_Identity<Value>(), a)
{ }
};
bool cache_hash_code = false>
class unordered_multiset
: public hashtable <Value, Value, Alloc,
- detail::identity<Value>, Pred,
+ std::_Identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, false>
{
typedef hashtable<Value, Value, Alloc,
- detail::identity<Value>, Pred,
+ std::_Identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
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<Value>(), a)
+ detail::default_ranged_hash(), eql, std::_Identity<Value>(), a)
{ }
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<Value>(), a)
+ detail::default_ranged_hash(), eql, std::_Identity<Value>(), a)
{ }
};
{
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<typename Cntnr_T>
#ifndef _GLIBCXX_TESTSUITE_TR1_H
#define _GLIBCXX_TESTSUITE_TR1_H
-#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
namespace __gnu_test
{
// For tr1/type_traits.
- template<template<typename> class Category,
- typename Type>
+ template<template<typename> class Category, typename Type>
bool
test_category(bool value)
{
return ret;
}
- template<template<typename> class Property,
- typename Type>
+ template<template<typename> class Property, typename Type>
bool
test_property(typename Property<Type>::value_type value)
{
// For use in 8_c_compatibility.
template<typename R, typename T>
- typename std::__enable_if<bool, std::__are_same<R, T>::__value>::__type
+ typename __gnu_cxx::__enable_if<std::tr1::is_same<R, T>::value,
+ bool>::__type
check_ret_type(T)
{ return true; }