Commit 15d72060 by Paolo Carlini Committed by Paolo Carlini

stl_construct.h: Wrap overlong lines, reformat according to the coding standards.

2004-02-06  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_construct.h: Wrap overlong lines, reformat
	according to the coding standards.
	* include/bits/stl_pair.h: Likewise.
	* include/bits/stl_raw_storage_iter.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/stream_iterator.h: Likewise.
	* include/bits/streambuf_iterator.h: Likewise.
	* include/bits/type_traits.h: Likewise.

From-SVN: r77425
parent 0a2d3d69
2004-02-06 Paolo Carlini <pcarlini@suse.de> 2004-02-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_construct.h: Wrap overlong lines, reformat
according to the coding standards.
* include/bits/stl_pair.h: Likewise.
* include/bits/stl_raw_storage_iter.h: Likewise.
* include/bits/stl_stack.h: Likewise.
* include/bits/stl_uninitialized.h: Likewise.
* include/bits/stream_iterator.h: Likewise.
* include/bits/streambuf_iterator.h: Likewise.
* include/bits/type_traits.h: Likewise.
2004-02-06 Paolo Carlini <pcarlini@suse.de>
* testsuite/27_io/basic_filebuf/open/char/9507.cc: * testsuite/27_io/basic_filebuf/open/char/9507.cc:
Adjust timings. Adjust timings.
......
// nonstandard construct and destroy functions -*- C++ -*- // nonstandard construct and destroy functions -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -115,7 +115,8 @@ namespace std ...@@ -115,7 +115,8 @@ namespace std
*/ */
template<typename _ForwardIterator> template<typename _ForwardIterator>
inline void inline void
__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type) __destroy_aux(_ForwardIterator __first, _ForwardIterator __last,
__false_type)
{ for ( ; __first != __last; ++__first) std::_Destroy(&*__first); } { for ( ; __first != __last; ++__first) std::_Destroy(&*__first); }
/** /**
......
// Pair implementation -*- C++ -*- // Pair implementation -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -64,68 +64,71 @@ ...@@ -64,68 +64,71 @@
namespace std namespace std
{ {
/// pair holds two objects of arbitrary type. /// pair holds two objects of arbitrary type.
template <class _T1, class _T2> template <class _T1, class _T2>
struct pair { struct pair
{
typedef _T1 first_type; ///< @c first_type is the first bound type typedef _T1 first_type; ///< @c first_type is the first bound type
typedef _T2 second_type; ///< @c second_type is the second bound type typedef _T2 second_type; ///< @c second_type is the second bound type
_T1 first; ///< @c first is a copy of the first object _T1 first; ///< @c first is a copy of the first object
_T2 second; ///< @c second is a copy of the second object _T2 second; ///< @c second is a copy of the second object
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 265. std::pair::pair() effects overly restrictive // 265. std::pair::pair() effects overly restrictive
/** The default constructor creates @c first and @c second using their /** The default constructor creates @c first and @c second using their
* respective default constructors. */ * respective default constructors. */
pair() : first(), second() {} pair()
: first(), second() {}
/** Two objects may be passed to a @c pair constructor to be copied. */ /** Two objects may be passed to a @c pair constructor to be copied. */
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} pair(const _T1& __a, const _T2& __b)
: first(__a), second(__b) {}
/** There is also a templated copy ctor for the @c pair class itself. */ /** There is also a templated copy ctor for the @c pair class itself. */
template <class _U1, class _U2> template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} pair(const pair<_U1, _U2>& __p)
}; : first(__p.first), second(__p.second) {}
};
/// Two pairs of the same type are equal iff their members are equal.
template <class _T1, class _T2> /// Two pairs of the same type are equal iff their members are equal.
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) template <class _T1, class _T2>
{ inline bool
return __x.first == __y.first && __x.second == __y.second; operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
} { return __x.first == __y.first && __x.second == __y.second; }
/// <http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt> /// <http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt>
template <class _T1, class _T2> template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) inline bool
{ operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return __x.first < __y.first || { return __x.first < __y.first
(!(__y.first < __x.first) && __x.second < __y.second); || (!(__y.first < __x.first) && __x.second < __y.second); }
}
/// Uses @c operator== to find the result.
/// Uses @c operator== to find the result. template <class _T1, class _T2>
template <class _T1, class _T2> inline bool
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return !(__x == __y); { return !(__x == __y); }
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result. template <class _T1, class _T2>
template <class _T1, class _T2> inline bool
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return __y < __x; { return __y < __x; }
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result. template <class _T1, class _T2>
template <class _T1, class _T2> inline bool
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return !(__y < __x); { return !(__y < __x); }
}
/// Uses @c operator< to find the result.
/// Uses @c operator< to find the result. template <class _T1, class _T2>
template <class _T1, class _T2> inline bool
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
return !(__x < __y); { return !(__x < __y); }
}
/**
/**
* @brief A convenience wrapper for creating a pair from two objects. * @brief A convenience wrapper for creating a pair from two objects.
* @param x The first object. * @param x The first object.
* @param y The second object. * @param y The second object.
...@@ -134,14 +137,14 @@ inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { ...@@ -134,14 +137,14 @@ inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
* The standard requires that the objects be passed by reference-to-const, * The standard requires that the objects be passed by reference-to-const,
* but LWG issue #181 says they should be passed by const value. We follow * but LWG issue #181 says they should be passed by const value. We follow
* the LWG by default. * the LWG by default.
*/ */
template <class _T1, class _T2> template <class _T1, class _T2>
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 181. make_pair() unintended behavior // _GLIBCXX_RESOLVE_LIB_DEFECTS
inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) // 181. make_pair() unintended behavior
{ inline pair<_T1, _T2>
return pair<_T1, _T2>(__x, __y); make_pair(_T1 __x, _T2 __y)
} { return pair<_T1, _T2>(__x, __y); }
} // namespace std } // namespace std
......
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -76,7 +76,8 @@ namespace std ...@@ -76,7 +76,8 @@ namespace std
public: public:
explicit explicit
raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {} raw_storage_iterator(_ForwardIterator __x)
: _M_iter(__x) {}
raw_storage_iterator& raw_storage_iterator&
operator*() { return *this; } operator*() { return *this; }
......
// Stack implementation -*- C++ -*- // Stack implementation -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -79,7 +79,6 @@ namespace std ...@@ -79,7 +79,6 @@ namespace std
inline bool inline bool
operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
/** /**
* @brief A standard container giving FILO behavior. * @brief A standard container giving FILO behavior.
* *
...@@ -141,17 +140,20 @@ namespace std ...@@ -141,17 +140,20 @@ namespace std
* @brief Default constructor creates no elements. * @brief Default constructor creates no elements.
*/ */
explicit explicit
stack(const _Sequence& __c = _Sequence()) : c(__c) {} stack(const _Sequence& __c = _Sequence())
: c(__c) {}
/** /**
* Returns true if the %stack is empty. * Returns true if the %stack is empty.
*/ */
bool bool
empty() const { return c.empty(); } empty() const
{ return c.empty(); }
/** Returns the number of elements in the %stack. */ /** Returns the number of elements in the %stack. */
size_type size_type
size() const { return c.size(); } size() const
{ return c.size(); }
/** /**
* Returns a read/write reference to the data at the first * Returns a read/write reference to the data at the first
...@@ -185,7 +187,8 @@ namespace std ...@@ -185,7 +187,8 @@ namespace std
* underlying sequence. * underlying sequence.
*/ */
void void
push(const value_type& __x) { c.push_back(__x); } push(const value_type& __x)
{ c.push_back(__x); }
/** /**
* @brief Removes first element. * @brief Removes first element.
...@@ -206,7 +209,6 @@ namespace std ...@@ -206,7 +209,6 @@ namespace std
} }
}; };
/** /**
* @brief Stack equality comparison. * @brief Stack equality comparison.
* @param x A %stack. * @param x A %stack.
...@@ -221,7 +223,7 @@ namespace std ...@@ -221,7 +223,7 @@ namespace std
*/ */
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return __x.c == __y.c; } { return __x.c == __y.c; }
/** /**
...@@ -239,31 +241,31 @@ namespace std ...@@ -239,31 +241,31 @@ namespace std
*/ */
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return __x.c < __y.c; } { return __x.c < __y.c; }
/// Based on operator== /// Based on operator==
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Seq> template<typename _Tp, typename _Seq>
inline bool inline bool
operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
} // namespace std } // namespace std
......
// Raw memory manipulators -*- C++ -*- // Raw memory manipulators -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -109,7 +109,8 @@ namespace std ...@@ -109,7 +109,8 @@ namespace std
{ {
typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD; typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD;
return std::__uninitialized_copy_aux(__first, __last, __result, _Is_POD()); return std::__uninitialized_copy_aux(__first, __last, __result,
_Is_POD());
} }
inline char* inline char*
...@@ -138,12 +139,12 @@ namespace std ...@@ -138,12 +139,12 @@ namespace std
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
void void
__uninitialized_fill_aux(_ForwardIterator __first, __uninitialized_fill_aux(_ForwardIterator __first, _ForwardIterator __last,
_ForwardIterator __last,
const _Tp& __x, __false_type) const _Tp& __x, __false_type)
{ {
_ForwardIterator __cur = __first; _ForwardIterator __cur = __first;
try { try
{
for ( ; __cur != __last; ++__cur) for ( ; __cur != __last; ++__cur)
std::_Construct(&*__cur, __x); std::_Construct(&*__cur, __x);
} }
...@@ -235,8 +236,10 @@ namespace std ...@@ -235,8 +236,10 @@ namespace std
_InputIterator2 __last2, _InputIterator2 __last2,
_ForwardIterator __result) _ForwardIterator __result)
{ {
_ForwardIterator __mid = std::uninitialized_copy(__first1, __last1, __result); _ForwardIterator __mid = std::uninitialized_copy(__first1, __last1,
try { __result);
try
{
return std::uninitialized_copy(__first2, __last2, __mid); return std::uninitialized_copy(__first2, __last2, __mid);
} }
catch(...) catch(...)
...@@ -252,11 +255,12 @@ namespace std ...@@ -252,11 +255,12 @@ namespace std
template<typename _ForwardIterator, typename _Tp, typename _InputIterator> template<typename _ForwardIterator, typename _Tp, typename _InputIterator>
inline _ForwardIterator inline _ForwardIterator
__uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid, __uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid,
const _Tp& __x, const _Tp& __x, _InputIterator __first,
_InputIterator __first, _InputIterator __last) _InputIterator __last)
{ {
std::uninitialized_fill(__result, __mid, __x); std::uninitialized_fill(__result, __mid, __x);
try { try
{
return std::uninitialized_copy(__first, __last, __mid); return std::uninitialized_copy(__first, __last, __mid);
} }
catch(...) catch(...)
...@@ -272,8 +276,8 @@ namespace std ...@@ -272,8 +276,8 @@ namespace std
template<typename _InputIterator, typename _ForwardIterator, typename _Tp> template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
inline void inline void
__uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1, __uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2, _ForwardIterator __first2,
const _Tp& __x) _ForwardIterator __last2, const _Tp& __x)
{ {
_ForwardIterator __mid2 = std::uninitialized_copy(__first1, __last1, _ForwardIterator __mid2 = std::uninitialized_copy(__first1, __last1,
__first2); __first2);
......
...@@ -59,10 +59,13 @@ namespace std ...@@ -59,10 +59,13 @@ namespace std
public: public:
/// Construct end of input stream iterator. /// Construct end of input stream iterator.
istream_iterator() : _M_stream(0), _M_ok(false) {} istream_iterator()
: _M_stream(0), _M_ok(false) {}
/// Construct start of input stream iterator. /// Construct start of input stream iterator.
istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); } istream_iterator(istream_type& __s)
: _M_stream(&__s)
{ _M_read(); }
istream_iterator(const istream_iterator& __obj) istream_iterator(const istream_iterator& __obj)
: _M_stream(__obj._M_stream), _M_value(__obj._M_value), : _M_stream(__obj._M_stream), _M_value(__obj._M_value),
...@@ -104,7 +107,7 @@ namespace std ...@@ -104,7 +107,7 @@ namespace std
bool bool
_M_equal(const istream_iterator& __x) const _M_equal(const istream_iterator& __x) const
{ return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);} { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }
private: private:
void void
...@@ -133,7 +136,6 @@ namespace std ...@@ -133,7 +136,6 @@ namespace std
const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
{ return !__x._M_equal(__y); } { return !__x._M_equal(__y); }
/** /**
* @brief Provides output iterator semantics for streams. * @brief Provides output iterator semantics for streams.
* *
...@@ -197,13 +199,16 @@ namespace std ...@@ -197,13 +199,16 @@ namespace std
} }
ostream_iterator& ostream_iterator&
operator*() { return *this; } operator*()
{ return *this; }
ostream_iterator& ostream_iterator&
operator++() { return *this; } operator++()
{ return *this; }
ostream_iterator& ostream_iterator&
operator++(int) { return *this; } operator++(int)
{ return *this; }
}; };
} // namespace std } // namespace std
#endif #endif
...@@ -159,8 +159,8 @@ namespace std ...@@ -159,8 +159,8 @@ namespace std
{ {
if (!traits_type::eq_int_type(_M_c, __eof)) if (!traits_type::eq_int_type(_M_c, __eof))
__ret = _M_c; __ret = _M_c;
else else if (traits_type::eq_int_type((__ret = _M_sbuf->sgetc()),
if (traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), __eof)) __eof))
_M_sbuf = 0; _M_sbuf = 0;
} }
return __ret; return __ret;
...@@ -248,7 +248,8 @@ namespace std ...@@ -248,7 +248,8 @@ namespace std
_M_put(const _CharT* __ws, streamsize __len) _M_put(const _CharT* __ws, streamsize __len)
{ {
if (__builtin_expect(!_M_failed, true) if (__builtin_expect(!_M_failed, true)
&& __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, false)) && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len,
false))
_M_failed = true; _M_failed = true;
return *this; return *this;
} }
......
// Type traits implementation -*- C++ -*- // Type traits implementation -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -91,7 +91,8 @@ struct __true_type {}; ...@@ -91,7 +91,8 @@ struct __true_type {};
struct __false_type {}; struct __false_type {};
template <class _Tp> template <class _Tp>
struct __type_traits { struct __type_traits
{
typedef __true_type this_dummy_member_must_be_first; typedef __true_type this_dummy_member_must_be_first;
/* Do not remove this member. It informs a compiler which /* Do not remove this member. It informs a compiler which
automatically specializes __type_traits that this automatically specializes __type_traits that this
...@@ -115,222 +116,287 @@ struct __type_traits { ...@@ -115,222 +116,287 @@ struct __type_traits {
typedef __false_type has_trivial_assignment_operator; typedef __false_type has_trivial_assignment_operator;
typedef __false_type has_trivial_destructor; typedef __false_type has_trivial_destructor;
typedef __false_type is_POD_type; typedef __false_type is_POD_type;
}; };
// Provide some specializations. // Provide some specializations.
template<> struct __type_traits<bool> { template<>
struct __type_traits<bool>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<char> { template<>
struct __type_traits<char>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<signed char> { template<>
struct __type_traits<signed char>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<unsigned char> { template<>
struct __type_traits<unsigned char>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<wchar_t> { template<>
struct __type_traits<wchar_t>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<short> { template<>
struct __type_traits<short>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<unsigned short> { template<>
struct __type_traits<unsigned short>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<int> { template<>
struct __type_traits<int>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<unsigned int> { template<>
struct __type_traits<unsigned int>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<long> { template<>
struct __type_traits<long>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<unsigned long> { template<>
struct __type_traits<unsigned long>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<long long> { template<>
struct __type_traits<long long>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<unsigned long long> { template<>
struct __type_traits<unsigned long long>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<float> { template<>
struct __type_traits<float>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<double> { template<>
struct __type_traits<double>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template<> struct __type_traits<long double> { template<>
struct __type_traits<long double>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
template <class _Tp> template <class _Tp>
struct __type_traits<_Tp*> { struct __type_traits<_Tp*>
{
typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor; typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type; typedef __true_type is_POD_type;
}; };
// The following could be written in terms of numeric_limits. // The following could be written in terms of numeric_limits.
// We're doing it separately to reduce the number of dependencies. // We're doing it separately to reduce the number of dependencies.
template <class _Tp> struct _Is_integer { template <class _Tp>
struct _Is_integer
{
typedef __false_type _Integral; typedef __false_type _Integral;
}; };
template<> struct _Is_integer<bool> { template<>
struct _Is_integer<bool>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<char> { template<>
struct _Is_integer<char>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<signed char> { template<>
struct _Is_integer<signed char>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<unsigned char> { template<>
struct _Is_integer<unsigned char>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<wchar_t> { template<>
struct _Is_integer<wchar_t>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<short> { template<>
struct _Is_integer<short>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<unsigned short> { template<>
struct _Is_integer<unsigned short>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<int> { template<>
struct _Is_integer<int>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<unsigned int> { template<>
struct _Is_integer<unsigned int>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<long> { template<>
struct _Is_integer<long>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<unsigned long> { template<>
struct _Is_integer<unsigned long>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<long long> { template<>
struct _Is_integer<long long>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<> struct _Is_integer<unsigned long long> { template<>
struct _Is_integer<unsigned long long>
{
typedef __true_type _Integral; typedef __true_type _Integral;
}; };
template<typename _Tp> struct _Is_normal_iterator { template<typename _Tp>
struct _Is_normal_iterator
{
typedef __false_type _Normal; typedef __false_type _Normal;
}; };
// Forward declaration hack, should really include this from somewhere. // Forward declaration hack, should really include this from somewhere.
namespace __gnu_cxx namespace __gnu_cxx
{ {
template<typename _Iterator, typename _Container> class __normal_iterator; template<typename _Iterator, typename _Container>
class __normal_iterator;
} }
template<typename _Iterator, typename _Container> template<typename _Iterator, typename _Container>
struct _Is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator, _Container> > { struct _Is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
_Container> >
{
typedef __true_type _Normal; typedef __true_type _Normal;
}; };
#endif /* _TYPE_TRAITS_H */ #endif /* _TYPE_TRAITS_H */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment