cpp_type_traits.h: Rename _M_type fields to __value...

2005-02-01  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/cpp_type_traits.h: Rename _M_type fields to
	__value, except for __enable_if, _M_type -> __type, consistently
	with the other traits.
	* include/bits/stl_algobase.h: Tweak consistently.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/valarray_array.h: Likewise.
	* include/c_std/std_cmath.h: Likewise.
	* include/debug/safe_iterator.h: Likewise.
	* include/std/std_complex.h: Likewise.

From-SVN: r94538
This commit is contained in:
Paolo Carlini 2005-02-01 13:30:34 +00:00 committed by Paolo Carlini
parent bbcb0c056b
commit 4d73fac958
8 changed files with 96 additions and 88 deletions

View File

@ -1,3 +1,15 @@
2005-02-01 Paolo Carlini <pcarlini@suse.de>
* include/bits/cpp_type_traits.h: Rename _M_type fields to
__value, except for __enable_if, _M_type -> __type, consistently
with the other traits.
* include/bits/stl_algobase.h: Tweak consistently.
* include/bits/stl_tree.h: Likewise.
* include/bits/valarray_array.h: Likewise.
* include/c_std/std_cmath.h: Likewise.
* include/debug/safe_iterator.h: Likewise.
* include/std/std_complex.h: Likewise.
2005-01-31 Brad Spencer <spencer@infointeractive.com>
* crossconfig.m4: Repair Solaris cross bits for strtold and strtof.

View File

@ -77,10 +77,10 @@ namespace __gnu_internal
typedef char __one;
typedef char __two[2];
template <typename _Tp>
__one __test_type (int _Tp::*);
template <typename _Tp>
__two& __test_type (...);
template<typename _Tp>
__one __test_type(int _Tp::*);
template<typename _Tp>
__two& __test_type(...);
} // namespace __gnu_internal
// Forward declaration hack, should really include this from somewhere.
@ -106,27 +106,23 @@ namespace std
template<class _Sp, class _Tp>
struct __traitor
{
enum { _M_type = _Sp::_M_type || _Tp::_M_type };
typedef typename __truth_type<_M_type>::__type __type;
enum { __value = _Sp::__value || _Tp::__value };
typedef typename __truth_type<__value>::__type __type;
};
// Compare for equality of types.
template<typename, typename>
struct __are_same
{
enum
{
_M_type = 0
};
enum { __value = 0 };
typedef __false_type __type;
};
template<typename _Tp>
struct __are_same<_Tp, _Tp>
{
enum
{
_M_type = 1
};
enum { __value = 1 };
typedef __true_type __type;
};
// Define a nested type if some predicate holds.
@ -138,21 +134,21 @@ namespace std
template<typename _Tp>
struct __enable_if<_Tp, true>
{
typedef _Tp _M_type;
typedef _Tp __type;
};
// Holds if the template-argument is a void type.
template<typename _Tp>
struct __is_void
{
enum { _M_type = 0 };
enum { __value = 0 };
typedef __false_type __type;
};
template<>
struct __is_void<void>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -162,7 +158,7 @@ namespace std
template<typename _Tp>
struct __is_integer
{
enum { _M_type = 0 };
enum { __value = 0 };
typedef __false_type __type;
};
@ -172,28 +168,28 @@ namespace std
template<>
struct __is_integer<bool>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<char>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<signed char>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<unsigned char>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -201,7 +197,7 @@ namespace std
template<>
struct __is_integer<wchar_t>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
# endif
@ -209,56 +205,56 @@ namespace std
template<>
struct __is_integer<short>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<unsigned short>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<int>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<unsigned int>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<long>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<unsigned long>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<long long>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_integer<unsigned long long>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -268,7 +264,7 @@ namespace std
template<typename _Tp>
struct __is_floating
{
enum { _M_type = 0 };
enum { __value = 0 };
typedef __false_type __type;
};
@ -276,21 +272,21 @@ namespace std
template<>
struct __is_floating<float>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_floating<double>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
template<>
struct __is_floating<long double>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -300,14 +296,14 @@ namespace std
template<typename _Tp>
struct __is_pointer
{
enum { _M_type = 0 };
enum { __value = 0 };
typedef __false_type __type;
};
template<typename _Tp>
struct __is_pointer<_Tp*>
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -317,7 +313,7 @@ namespace std
template<typename _Tp>
struct __is_normal_iterator
{
enum { _M_type = 0 };
enum { __value = 0 };
typedef __false_type __type;
};
@ -325,7 +321,7 @@ namespace std
struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
_Container> >
{
enum { _M_type = 1 };
enum { __value = 1 };
typedef __true_type __type;
};
@ -361,7 +357,7 @@ namespace std
{
enum
{
_M_type = (sizeof(__gnu_internal::__test_type<_Tp>(0))
__value = (sizeof(__gnu_internal::__test_type<_Tp>(0))
!= sizeof(__gnu_internal::__one))
};
};

View File

@ -155,7 +155,7 @@ namespace std
_ValueType2>)
__glibcxx_function_requires(_ConvertibleConcept<_ValueType2,
_ValueType1>)
std::__iter_swap<__are_same<_ValueType1, _ValueType2>::_M_type>::
std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value>::
iter_swap(__a, __b);
}
@ -302,10 +302,10 @@ namespace std
typedef typename iterator_traits<_II>::value_type _ValueTypeI;
typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
typedef typename iterator_traits<_II>::iterator_category _Category;
const bool __simple = (__is_scalar<_ValueTypeI>::_M_type
&& __is_pointer<_II>::_M_type
&& __is_pointer<_OI>::_M_type
&& __are_same<_ValueTypeI, _ValueTypeO>::_M_type);
const bool __simple = (__is_scalar<_ValueTypeI>::__value
&& __is_pointer<_II>::__value
&& __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value);
return std::__copy<__simple, _Category>::copy(__first, __last, __result);
}
@ -374,8 +374,8 @@ namespace std
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
const bool __in = __is_normal_iterator<_InputIterator>::_M_type;
const bool __out = __is_normal_iterator<_OutputIterator>::_M_type;
const bool __in = __is_normal_iterator<_InputIterator>::__value;
const bool __out = __is_normal_iterator<_OutputIterator>::__value;
return std::__copy_normal<__in, __out>::copy_n(__first, __last,
__result);
}
@ -427,10 +427,10 @@ namespace std
typedef typename iterator_traits<_BI1>::value_type _ValueType1;
typedef typename iterator_traits<_BI2>::value_type _ValueType2;
typedef typename iterator_traits<_BI1>::iterator_category _Category;
const bool __simple = (__is_scalar<_ValueType1>::_M_type
&& __is_pointer<_BI1>::_M_type
&& __is_pointer<_BI2>::_M_type
&& __are_same<_ValueType1, _ValueType2>::_M_type);
const bool __simple = (__is_scalar<_ValueType1>::__value
&& __is_pointer<_BI1>::__value
&& __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value);
return std::__copy_backward<__simple, _Category>::copy_b(__first, __last,
__result);
@ -504,8 +504,8 @@ namespace std
typename iterator_traits<_BI2>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
const bool __bi1 = __is_normal_iterator<_BI1>::_M_type;
const bool __bi2 = __is_normal_iterator<_BI2>::_M_type;
const bool __bi1 = __is_normal_iterator<_BI1>::__value;
const bool __bi2 = __is_normal_iterator<_BI2>::__value;
return std::__copy_backward_normal<__bi1, __bi2>::copy_b_n(__first, __last,
__result);
}
@ -557,7 +557,7 @@ namespace std
_ForwardIterator>)
__glibcxx_requires_valid_range(__first, __last);
const bool __scalar = __is_scalar<_Tp>::_M_type;
const bool __scalar = __is_scalar<_Tp>::__value;
std::__fill<__scalar>::fill(__first, __last, __value);
}
@ -631,7 +631,7 @@ namespace std
// concept requirements
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _Tp>)
const bool __scalar = __is_scalar<_Tp>::_M_type;
const bool __scalar = __is_scalar<_Tp>::__value;
return std::__fill_n<__scalar>::fill_n(__first, __n, __value);
}

View File

@ -392,7 +392,7 @@ namespace std
protected:
template<typename _Key_compare,
bool _Is_pod_comparator = std::__is_pod<_Key_compare>::_M_type>
bool _Is_pod_comparator = std::__is_pod<_Key_compare>::__value>
struct _Rb_tree_impl : public _Node_allocator
{
_Key_compare _M_key_compare;

View File

@ -1,6 +1,6 @@
// The template and inlines for the -*- C++ -*- internal _Array helper class.
// Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004
// Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -98,7 +98,7 @@ namespace std
inline void
__valarray_default_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
{
_Array_default_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
_Array_default_ctor<_Tp, __is_fundamental<_Tp>::__value>::
_S_do_it(__b, __e);
}
@ -134,7 +134,7 @@ namespace std
__valarray_fill_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e,
const _Tp __t)
{
_Array_init_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
_Array_init_ctor<_Tp, __is_fundamental<_Tp>::__value>::
_S_do_it(__b, __e, __t);
}
@ -171,7 +171,7 @@ namespace std
const _Tp* __restrict__ __e,
_Tp* __restrict__ __o)
{
_Array_copy_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
_Array_copy_ctor<_Tp, __is_fundamental<_Tp>::__value>::
_S_do_it(__b, __e, __o);
}
@ -181,7 +181,7 @@ namespace std
__valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
size_t __s, _Tp* __restrict__ __o)
{
if (__is_fundamental<_Tp>::_M_type)
if (__is_fundamental<_Tp>::__value)
while (__n--)
{
*__o++ = *__a;
@ -202,7 +202,7 @@ namespace std
const size_t* __restrict__ __i,
_Tp* __restrict__ __o, size_t __n)
{
if (__is_fundamental<_Tp>::_M_type)
if (__is_fundamental<_Tp>::__value)
while (__n--)
*__o++ = __a[*__i++];
else
@ -215,7 +215,7 @@ namespace std
inline void
__valarray_destroy_elements(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
{
if (!__is_fundamental<_Tp>::_M_type)
if (!__is_fundamental<_Tp>::__value)
while (__b != __e)
{
__b->~_Tp();
@ -279,7 +279,7 @@ namespace std
__valarray_copy(const _Tp* __restrict__ __a, size_t __n,
_Tp* __restrict__ __b)
{
_Array_copier<_Tp, __is_fundamental<_Tp>::_M_type>::
_Array_copier<_Tp, __is_fundamental<_Tp>::__value>::
_S_do_it(__a, __n, __b);
}

View File

@ -107,7 +107,7 @@ namespace std
{ return __builtin_acosl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
acos(_Tp __x)
{
return __builtin_acos(__x);
@ -124,7 +124,7 @@ namespace std
{ return __builtin_asinl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
asin(_Tp __x)
{ return __builtin_asin(__x); }
@ -139,7 +139,7 @@ namespace std
{ return __builtin_atanl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
atan(_Tp __x)
{ return __builtin_atan(__x); }
@ -154,8 +154,8 @@ namespace std
{ return __builtin_atan2l(__y, __x); }
template<typename _Tp, typename _Up>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type
&& __is_integer<_Up>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value
&& __is_integer<_Up>::__value>::__type
atan2(_Tp __y, _Up __x)
{ return __builtin_atan2(__y, __x); }
@ -170,7 +170,7 @@ namespace std
{ return __builtin_ceill(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
ceil(_Tp __x)
{ return __builtin_ceil(__x); }
@ -185,7 +185,7 @@ namespace std
{ return __builtin_cosl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
cos(_Tp __x)
{ return __builtin_cos(__x); }
@ -200,7 +200,7 @@ namespace std
{ return __builtin_coshl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
cosh(_Tp __x)
{ return __builtin_cosh(__x); }
@ -215,7 +215,7 @@ namespace std
{ return __builtin_expl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
exp(_Tp __x)
{ return __builtin_exp(__x); }
@ -230,7 +230,7 @@ namespace std
{ return __builtin_fabsl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
fabs(_Tp __x)
{ return __builtin_fabs(__x); }
@ -245,7 +245,7 @@ namespace std
{ return __builtin_floorl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
floor(_Tp __x)
{ return __builtin_floor(__x); }
@ -270,7 +270,7 @@ namespace std
{ return __builtin_frexpl(__x, __exp); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
frexp(_Tp __x, int* __exp)
{ return __builtin_frexp(__x, __exp); }
@ -285,7 +285,7 @@ namespace std
{ return __builtin_ldexpl(__x, __exp); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
ldexp(_Tp __x, int __exp)
{ return __builtin_ldexp(__x, __exp); }
@ -300,7 +300,7 @@ namespace std
{ return __builtin_logl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
log(_Tp __x)
{ return __builtin_log(__x); }
@ -315,7 +315,7 @@ namespace std
{ return __builtin_log10l(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
log10(_Tp __x)
{ return __builtin_log10(__x); }
@ -371,7 +371,7 @@ namespace std
{ return __builtin_sinl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
sin(_Tp __x)
{ return __builtin_sin(__x); }
@ -386,7 +386,7 @@ namespace std
{ return __builtin_sinhl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
sinh(_Tp __x)
{ return __builtin_sinh(__x); }
@ -401,7 +401,7 @@ namespace std
{ return __builtin_sqrtl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
sqrt(_Tp __x)
{ return __builtin_sqrt(__x); }
@ -416,7 +416,7 @@ namespace std
{ return __builtin_tanl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
tan(_Tp __x)
{ return __builtin_tan(__x); }
@ -431,7 +431,7 @@ namespace std
{ return __builtin_tanhl(__x); }
template<typename _Tp>
inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
inline typename __enable_if<double, __is_integer<_Tp>::__value>::__type
tanh(_Tp __x)
{ return __builtin_tanh(__x); }
}

View File

@ -1,6 +1,6 @@
// Safe iterator implementation -*- C++ -*-
// Copyright (C) 2003, 2004
// Copyright (C) 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -139,8 +139,8 @@ namespace __gnu_debug
typename std::__enable_if<
_Sequence,
(std::__are_same<_MutableIterator,
typename _Sequence::iterator::_Base_iterator>::_M_type)
>::_M_type>& __x)
typename _Sequence::iterator::_Base_iterator>::__value)
>::__type>& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
{
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),

View File

@ -640,7 +640,7 @@ namespace std
inline _Tp
norm(const complex<_Tp>& __z)
{
return _Norm_helper<__is_floating<_Tp>::_M_type
return _Norm_helper<__is_floating<_Tp>::__value
&& !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
}