* [v3] Trivial formatting fixes
@ 2004-06-12 12:30 Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2004-06-12 12:30 UTC (permalink / raw)
To: 'gcc-patches@gcc.gnu.org'
[-- Attachment #1: Type: text/plain, Size: 70 bytes --]
Hi,
tested x86-linux, committed to mainline.
Paolo.
//////////////
[-- Attachment #2: CL_ref_ext_1 --]
[-- Type: text/plain, Size: 208 bytes --]
2004-06-12 Paolo Carlini <pcarlini@suse.de>
* include/ext/algorithm: Trivial formatting fixes.
* include/ext/functional: Likewise.
* include/ext/hash_fun.h: Likewise.
* include/ext/iterator: Likewise.
[-- Attachment #3: patch_ref_ext_1 --]
[-- Type: text/plain, Size: 38585 bytes --]
diff -urN libstdc++-v3-orig/include/ext/algorithm libstdc++-v3/include/ext/algorithm
--- libstdc++-v3-orig/include/ext/algorithm 2003-12-09 05:31:53.000000000 +0100
+++ libstdc++-v3/include/ext/algorithm 2004-06-12 00:55:21.000000000 +0200
@@ -1,6 +1,6 @@
// Algorithm extensions -*- 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
// software; you can redistribute it and/or modify it under the
@@ -84,11 +84,12 @@
_OutputIterator __result,
input_iterator_tag)
{
- for ( ; __count > 0; --__count) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
+ for ( ; __count > 0; --__count)
+ {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
return pair<_InputIterator, _OutputIterator>(__first, __result);
}
@@ -99,8 +100,9 @@
random_access_iterator_tag)
{
_RAIterator __last = __first + __count;
- return pair<_RAIterator, _OutputIterator>(__last,
- std::copy(__first, __last, __result));
+ return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first,
+ __last,
+ __result));
}
/**
@@ -132,23 +134,24 @@
template<typename _InputIterator1, typename _InputIterator2>
int
- __lexicographical_compare_3way(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2)
- {
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first1 < *__first2)
- return -1;
- if (*__first2 < *__first1)
- return 1;
- ++__first1;
- ++__first2;
- }
- if (__first2 == __last2) {
+ __lexicographical_compare_3way(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2)
+ {
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (*__first1 < *__first2)
+ return -1;
+ if (*__first2 < *__first1)
+ return 1;
+ ++__first1;
+ ++__first2;
+ }
+ if (__first2 == __last2)
return !(__first1 == __last1);
- }
- else {
+ else
return -1;
- }
}
inline int
@@ -169,11 +172,10 @@
const char* __first2, const char* __last2)
{
#if CHAR_MAX == SCHAR_MAX
- return __lexicographical_compare_3way(
- (const signed char*) __first1,
- (const signed char*) __last1,
- (const signed char*) __first2,
- (const signed char*) __last2);
+ return __lexicographical_compare_3way((const signed char*) __first1,
+ (const signed char*) __last1,
+ (const signed char*) __first2,
+ (const signed char*) __last2);
#else
return __lexicographical_compare_3way((const unsigned char*) __first1,
(const unsigned char*) __last1,
@@ -198,8 +200,10 @@
*/
template<typename _InputIterator1, typename _InputIterator2>
int
- lexicographical_compare_3way(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2)
+ lexicographical_compare_3way(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
@@ -211,12 +215,12 @@
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
+ return __lexicographical_compare_3way(__first1, __last1, __first2,
+ __last2);
}
// count and count_if: this version, whose return type is void, was present
// in the HP STL, and is retained as an extension for backward compatibility.
-
template<typename _InputIterator, typename _Tp, typename _Size>
void
count(_InputIterator __first, _InputIterator __last,
@@ -259,7 +263,8 @@
* @ingroup SGIextensions
* @doctodo
*/
- template<typename _ForwardIterator, typename _OutputIterator, typename _Distance>
+ template<typename _ForwardIterator, typename _OutputIterator,
+ typename _Distance>
_OutputIterator
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __out, const _Distance __n)
@@ -273,16 +278,17 @@
_Distance __remaining = std::distance(__first, __last);
_Distance __m = min(__n, __remaining);
- while (__m > 0) {
- if ((std::rand() % __remaining) < __m) {
+ while (__m > 0)
+ {
+ if ((std::rand() % __remaining) < __m)
+ {
*__out = *__first;
++__out;
--__m;
+ }
+ --__remaining;
+ ++__first;
}
-
- --__remaining;
- ++__first;
- }
return __out;
}
@@ -291,8 +297,8 @@
* @ingroup SGIextensions
* @doctodo
*/
- template<typename _ForwardIterator, typename _OutputIterator, typename _Distance,
- typename _RandomNumberGenerator>
+ template<typename _ForwardIterator, typename _OutputIterator,
+ typename _Distance, typename _RandomNumberGenerator>
_OutputIterator
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __out, const _Distance __n,
@@ -309,20 +315,22 @@
_Distance __remaining = std::distance(__first, __last);
_Distance __m = min(__n, __remaining);
- while (__m > 0) {
- if (__rand(__remaining) < __m) {
+ while (__m > 0)
+ {
+ if (__rand(__remaining) < __m)
+ {
*__out = *__first;
++__out;
--__m;
+ }
+ --__remaining;
+ ++__first;
}
-
- --__remaining;
- ++__first;
- }
return __out;
}
- template<typename _InputIterator, typename _RandomAccessIterator, typename _Distance>
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _Distance>
_RandomAccessIterator
__random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out,
@@ -333,14 +341,14 @@
for ( ; __first != __last && __m < __n; ++__m, ++__first)
__out[__m] = *__first;
- while (__first != __last) {
- ++__t;
- _Distance __M = std::rand() % (__t);
- if (__M < __n)
- __out[__M] = *__first;
- ++__first;
- }
-
+ while (__first != __last)
+ {
+ ++__t;
+ _Distance __M = std::rand() % (__t);
+ if (__M < __n)
+ __out[__M] = *__first;
+ ++__first;
+ }
return __out + __m;
}
@@ -361,14 +369,14 @@
for ( ; __first != __last && __m < __n; ++__m, ++__first)
__out[__m] = *__first;
- while (__first != __last) {
- ++__t;
- _Distance __M = __rand(__t);
- if (__M < __n)
- __out[__M] = *__first;
- ++__first;
- }
-
+ while (__first != __last)
+ {
+ ++__t;
+ _Distance __M = __rand(__t);
+ if (__M < __n)
+ __out[__M] = *__first;
+ ++__first;
+ }
return __out + __m;
}
@@ -380,7 +388,8 @@
template<typename _InputIterator, typename _RandomAccessIterator>
inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __out_first, _RandomAccessIterator __out_last)
+ _RandomAccessIterator __out_first,
+ _RandomAccessIterator __out_last)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
@@ -402,7 +411,8 @@
typename _RandomNumberGenerator>
inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __out_first, _RandomAccessIterator __out_last,
+ _RandomAccessIterator __out_first,
+ _RandomAccessIterator __out_last,
_RandomNumberGenerator& __rand)
{
// concept requirements
@@ -427,7 +437,8 @@
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
// concept requirements
- __glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
@@ -446,7 +457,8 @@
_StrictWeakOrdering __comp)
{
// concept requirements
- __glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
typename iterator_traits<_RandomAccessIterator>::value_type,
typename iterator_traits<_RandomAccessIterator>::value_type>)
@@ -478,11 +490,9 @@
return true;
_ForwardIterator __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next) {
+ for (++__next; __next != __last; __first = __next, ++__next)
if (*__next < *__first)
return false;
- }
-
return true;
}
@@ -493,7 +503,8 @@
*/
template<typename _ForwardIterator, typename _StrictWeakOrdering>
bool
- is_sorted(_ForwardIterator __first, _ForwardIterator __last, _StrictWeakOrdering __comp)
+ is_sorted(_ForwardIterator __first, _ForwardIterator __last,
+ _StrictWeakOrdering __comp)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
@@ -506,11 +517,9 @@
return true;
_ForwardIterator __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next) {
+ for (++__next; __next != __last; __first = __next, ++__next)
if (__comp(*__next, *__first))
return false;
- }
-
return true;
}
} // namespace __gnu_cxx
diff -urN libstdc++-v3-orig/include/ext/functional libstdc++-v3/include/ext/functional
--- libstdc++-v3-orig/include/ext/functional 2003-12-09 05:31:53.000000000 +0100
+++ libstdc++-v3/include/ext/functional 2004-06-12 01:10:10.000000000 +0200
@@ -1,6 +1,6 @@
// Functional extensions -*- C++ -*-
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2004 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
@@ -68,328 +68,359 @@
namespace __gnu_cxx
{
-using std::unary_function;
-using std::binary_function;
-using std::mem_fun1_t;
-using std::const_mem_fun1_t;
-using std::mem_fun1_ref_t;
-using std::const_mem_fun1_ref_t;
-
-/** The @c identity_element functions are not part of the C++ standard; SGI
- * provided them as an extension. Its argument is an operation, and its
- * return value is the identity element for that operation. It is overloaded
- * for addition and multiplication, and you can overload it for your own
- * nefarious operations.
- *
- * @addtogroup SGIextensions
- * @{
-*/
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Tp> inline _Tp identity_element(std::plus<_Tp>) {
- return _Tp(0);
-}
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) {
- return _Tp(1);
-}
-/** @} */
-
-/** As an extension to the binders, SGI provided composition functors and
- * wrapper functions to aid in their creation. The @c unary_compose
- * functor is constructed from two functions/functors, @c f and @c g.
- * Calling @c operator() with a single argument @c x returns @c f(g(x)).
- * The function @c compose1 takes the two functions and constructs a
- * @c unary_compose variable for you.
- *
- * @c binary_compose is constructed from three functors, @c f, @c g1,
- * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
- * @compose2 takes f, g1, and g2, and constructs the @c binary_compose
- * instance for you. For example, if @c f returns an int, then
- * \code
- * int answer = (compose2(f,g1,g2))(x);
- * \endcode
- * is equivalent to
- * \code
- * int temp1 = g1(x);
- * int temp2 = g2(x);
- * int answer = f(temp1,temp2);
- * \endcode
- * But the first form is more compact, and can be passed around as a
- * functor to other algorithms.
- *
- * @addtogroup SGIextensions
- * @{
-*/
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Operation1, class _Operation2>
-class unary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
-{
-protected:
- _Operation1 _M_fn1;
- _Operation2 _M_fn2;
-public:
- unary_compose(const _Operation1& __x, const _Operation2& __y)
- : _M_fn1(__x), _M_fn2(__y) {}
- typename _Operation1::result_type
- operator()(const typename _Operation2::argument_type& __x) const {
- return _M_fn1(_M_fn2(__x));
- }
-};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Operation1, class _Operation2>
-inline unary_compose<_Operation1,_Operation2>
-compose1(const _Operation1& __fn1, const _Operation2& __fn2)
-{
- return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
-}
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Operation1, class _Operation2, class _Operation3>
-class binary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type> {
-protected:
- _Operation1 _M_fn1;
- _Operation2 _M_fn2;
- _Operation3 _M_fn3;
-public:
- binary_compose(const _Operation1& __x, const _Operation2& __y,
- const _Operation3& __z)
- : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
- typename _Operation1::result_type
- operator()(const typename _Operation2::argument_type& __x) const {
- return _M_fn1(_M_fn2(__x), _M_fn3(__x));
- }
-};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Operation1, class _Operation2, class _Operation3>
-inline binary_compose<_Operation1, _Operation2, _Operation3>
-compose2(const _Operation1& __fn1, const _Operation2& __fn2,
- const _Operation3& __fn3)
-{
- return binary_compose<_Operation1,_Operation2,_Operation3>
- (__fn1, __fn2, __fn3);
-}
-/** @} */
-
-/** As an extension, SGI provided a functor called @c identity. When a
- * functor is required but no operations are desired, this can be used as a
- * pass-through. Its @c operator() returns its argument unchanged.
- *
- * @addtogroup SGIextensions
-*/
-template <class _Tp> struct identity : public std::_Identity<_Tp> {};
-
-/** @c select1st and @c select2nd are extensions provided by SGI. Their
- * @c operator()s
- * take a @c std::pair as an argument, and return either the first member
- * or the second member, respectively. They can be used (especially with
- * the composition functors) to "strip" data from a sequence before
- * performing the remainder of an algorithm.
- *
- * @addtogroup SGIextensions
- * @{
-*/
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Pair> struct select1st : public std::_Select1st<_Pair> {};
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Pair> struct select2nd : public std::_Select2nd<_Pair> {};
-/** @} */
-
-// extension documented next
-template <class _Arg1, class _Arg2>
-struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
- _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
-};
-
-template <class _Arg1, class _Arg2>
-struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
- _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
-};
-
-/** The @c operator() of the @c project1st functor takes two arbitrary
- * arguments and returns the first one, while @c project2nd returns the
- * second one. They are extensions provided by SGI.
- *
- * @addtogroup SGIextensions
- * @{
-*/
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Arg1, class _Arg2>
-struct project1st : public _Project1st<_Arg1, _Arg2> {};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Arg1, class _Arg2>
-struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
-/** @} */
-
-// extension documented next
-template <class _Result>
-struct _Constant_void_fun {
- typedef _Result result_type;
- result_type _M_val;
-
- _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
- const result_type& operator()() const { return _M_val; }
-};
-
-template <class _Result, class _Argument>
-struct _Constant_unary_fun {
- typedef _Argument argument_type;
- typedef _Result result_type;
- result_type _M_val;
-
- _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
- const result_type& operator()(const _Argument&) const { return _M_val; }
-};
-
-template <class _Result, class _Arg1, class _Arg2>
-struct _Constant_binary_fun {
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
- _Result _M_val;
-
- _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
- const result_type& operator()(const _Arg1&, const _Arg2&) const {
- return _M_val;
- }
-};
-
-/** These three functors are each constructed from a single arbitrary
- * variable/value. Later, their @c operator()s completely ignore any
- * arguments passed, and return the stored value.
- * - @c constant_void_fun's @c operator() takes no arguments
- * - @c constant_unary_fun's @c operator() takes one argument (ignored)
- * - @c constant_binary_fun's @c operator() takes two arguments (ignored)
- *
- * The helper creator functions @c constant0, @c constant1, and
- * @c constant2 each take a "result" argument and construct variables of
- * the appropriate functor type.
- *
- * @addtogroup SGIextensions
- * @{
-*/
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result>
-struct constant_void_fun : public _Constant_void_fun<_Result> {
- constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {}
-};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result,
- class _Argument = _Result>
-struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
-{
- constant_unary_fun(const _Result& __v)
- : _Constant_unary_fun<_Result, _Argument>(__v) {}
-};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result,
- class _Arg1 = _Result,
- class _Arg2 = _Arg1>
-struct constant_binary_fun
- : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
-{
- constant_binary_fun(const _Result& __v)
- : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
-};
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result>
-inline constant_void_fun<_Result> constant0(const _Result& __val)
-{
- return constant_void_fun<_Result>(__val);
-}
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result>
-inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val)
-{
- return constant_unary_fun<_Result,_Result>(__val);
-}
-
-/// An \link SGIextensions SGI extension \endlink.
-template <class _Result>
-inline constant_binary_fun<_Result,_Result,_Result>
-constant2(const _Result& __val)
-{
- return constant_binary_fun<_Result,_Result,_Result>(__val);
-}
-/** @} */
-
-/** The @c subtractive_rng class is documented on
- * <a href="http://www.sgi.com/tech/stl/">SGI's site</a>.
- * Note that this code assumes that @c int is 32 bits.
- *
- * @ingroup SGIextensions
-*/
-class subtractive_rng : public unary_function<unsigned int, unsigned int> {
-private:
- unsigned int _M_table[55];
- size_t _M_index1;
- size_t _M_index2;
-public:
- /// Returns a number less than the argument.
- unsigned int operator()(unsigned int __limit) {
- _M_index1 = (_M_index1 + 1) % 55;
- _M_index2 = (_M_index2 + 1) % 55;
- _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
- return _M_table[_M_index1] % __limit;
- }
-
- void _M_initialize(unsigned int __seed)
+ using std::unary_function;
+ using std::binary_function;
+ using std::mem_fun1_t;
+ using std::const_mem_fun1_t;
+ using std::mem_fun1_ref_t;
+ using std::const_mem_fun1_ref_t;
+
+ /** The @c identity_element functions are not part of the C++ standard; SGI
+ * provided them as an extension. Its argument is an operation, and its
+ * return value is the identity element for that operation. It is overloaded
+ * for addition and multiplication, and you can overload it for your own
+ * nefarious operations.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Tp>
+ inline _Tp
+ identity_element(std::plus<_Tp>)
+ { return _Tp(0); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Tp>
+ inline _Tp
+ identity_element(std::multiplies<_Tp>)
+ { return _Tp(1); }
+ /** @} */
+
+ /** As an extension to the binders, SGI provided composition functors and
+ * wrapper functions to aid in their creation. The @c unary_compose
+ * functor is constructed from two functions/functors, @c f and @c g.
+ * Calling @c operator() with a single argument @c x returns @c f(g(x)).
+ * The function @c compose1 takes the two functions and constructs a
+ * @c unary_compose variable for you.
+ *
+ * @c binary_compose is constructed from three functors, @c f, @c g1,
+ * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
+ * @compose2 takes f, g1, and g2, and constructs the @c binary_compose
+ * instance for you. For example, if @c f returns an int, then
+ * \code
+ * int answer = (compose2(f,g1,g2))(x);
+ * \endcode
+ * is equivalent to
+ * \code
+ * int temp1 = g1(x);
+ * int temp2 = g2(x);
+ * int answer = f(temp1,temp2);
+ * \endcode
+ * But the first form is more compact, and can be passed around as a
+ * functor to other algorithms.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2>
+ class unary_compose
+ : public unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
+ {
+ protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+
+ public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const
+ { return _M_fn1(_M_fn2(__x)); }
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2>
+ inline unary_compose<_Operation1, _Operation2>
+ compose1(const _Operation1& __fn1, const _Operation2& __fn2)
+ { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2, class _Operation3>
+ class binary_compose
+ : public unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
+ {
+ protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+
+ public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const
+ { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2, class _Operation3>
+ inline binary_compose<_Operation1, _Operation2, _Operation3>
+ compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3)
+ { return binary_compose<_Operation1, _Operation2, _Operation3>
+ (__fn1, __fn2, __fn3); }
+ /** @} */
+
+ /** As an extension, SGI provided a functor called @c identity. When a
+ * functor is required but no operations are desired, this can be used as a
+ * pass-through. Its @c operator() returns its argument unchanged.
+ *
+ * @addtogroup SGIextensions
+ */
+ template <class _Tp>
+ struct identity : public std::_Identity<_Tp> {};
+
+ /** @c select1st and @c select2nd are extensions provided by SGI. Their
+ * @c operator()s
+ * take a @c std::pair as an argument, and return either the first member
+ * or the second member, respectively. They can be used (especially with
+ * the composition functors) to "strip" data from a sequence before
+ * performing the remainder of an algorithm.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Pair>
+ struct select1st : public std::_Select1st<_Pair> {};
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Pair>
+ struct select2nd : public std::_Select2nd<_Pair> {};
+ /** @} */
+
+ // extension documented next
+ template <class _Arg1, class _Arg2>
+ struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>
+ {
+ _Arg1
+ operator()(const _Arg1& __x, const _Arg2&) const
+ { return __x; }
+ };
+
+ template <class _Arg1, class _Arg2>
+ struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>
+ {
+ _Arg2
+ operator()(const _Arg1&, const _Arg2& __y) const
+ { return __y; }
+ };
+
+ /** The @c operator() of the @c project1st functor takes two arbitrary
+ * arguments and returns the first one, while @c project2nd returns the
+ * second one. They are extensions provided by SGI.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Arg1, class _Arg2>
+ struct project1st : public _Project1st<_Arg1, _Arg2> {};
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Arg1, class _Arg2>
+ struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
+ /** @} */
+
+ // extension documented next
+ template <class _Result>
+ struct _Constant_void_fun
+ {
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()() const
+ { return _M_val; }
+ };
+
+ template <class _Result, class _Argument>
+ struct _Constant_unary_fun
+ {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()(const _Argument&) const
+ { return _M_val; }
+ };
+
+ template <class _Result, class _Arg1, class _Arg2>
+ struct _Constant_binary_fun
+ {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()(const _Arg1&, const _Arg2&) const
+ { return _M_val; }
+ };
+
+ /** These three functors are each constructed from a single arbitrary
+ * variable/value. Later, their @c operator()s completely ignore any
+ * arguments passed, and return the stored value.
+ * - @c constant_void_fun's @c operator() takes no arguments
+ * - @c constant_unary_fun's @c operator() takes one argument (ignored)
+ * - @c constant_binary_fun's @c operator() takes two arguments (ignored)
+ *
+ * The helper creator functions @c constant0, @c constant1, and
+ * @c constant2 each take a "result" argument and construct variables of
+ * the appropriate functor type.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ struct constant_void_fun
+ : public _Constant_void_fun<_Result>
+ {
+ constant_void_fun(const _Result& __v)
+ : _Constant_void_fun<_Result>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result, class _Argument = _Result>
+ struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
+ {
+ constant_unary_fun(const _Result& __v)
+ : _Constant_unary_fun<_Result, _Argument>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1>
+ struct constant_binary_fun
+ : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
+ {
+ constant_binary_fun(const _Result& __v)
+ : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_void_fun<_Result>
+ constant0(const _Result& __val)
+ { return constant_void_fun<_Result>(__val); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_unary_fun<_Result, _Result>
+ constant1(const _Result& __val)
+ { return constant_unary_fun<_Result, _Result>(__val); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_binary_fun<_Result,_Result,_Result>
+ constant2(const _Result& __val)
+ { return constant_binary_fun<_Result, _Result, _Result>(__val); }
+ /** @} */
+
+ /** The @c subtractive_rng class is documented on
+ * <a href="http://www.sgi.com/tech/stl/">SGI's site</a>.
+ * Note that this code assumes that @c int is 32 bits.
+ *
+ * @ingroup SGIextensions
+ */
+ class subtractive_rng
+ : public unary_function<unsigned int, unsigned int>
{
- unsigned int __k = 1;
- _M_table[54] = __seed;
- size_t __i;
- for (__i = 0; __i < 54; __i++) {
- size_t __ii = (21 * (__i + 1) % 55) - 1;
- _M_table[__ii] = __k;
- __k = __seed - __k;
- __seed = _M_table[__ii];
+ private:
+ unsigned int _M_table[55];
+ size_t _M_index1;
+ size_t _M_index2;
+
+ public:
+ /// Returns a number less than the argument.
+ unsigned int
+ operator()(unsigned int __limit)
+ {
+ _M_index1 = (_M_index1 + 1) % 55;
+ _M_index2 = (_M_index2 + 1) % 55;
+ _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
+ return _M_table[_M_index1] % __limit;
}
- for (int __loop = 0; __loop < 4; __loop++) {
- for (__i = 0; __i < 55; __i++)
+
+ void
+ _M_initialize(unsigned int __seed)
+ {
+ unsigned int __k = 1;
+ _M_table[54] = __seed;
+ size_t __i;
+ for (__i = 0; __i < 54; __i++)
+ {
+ size_t __ii = (21 * (__i + 1) % 55) - 1;
+ _M_table[__ii] = __k;
+ __k = __seed - __k;
+ __seed = _M_table[__ii];
+ }
+ for (int __loop = 0; __loop < 4; __loop++)
+ {
+ for (__i = 0; __i < 55; __i++)
_M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
+ }
+ _M_index1 = 0;
+ _M_index2 = 31;
}
- _M_index1 = 0;
- _M_index2 = 31;
- }
-
- /// Ctor allowing you to initialize the seed.
- subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
- /// Default ctor; initializes its state with some number you don't see.
- subtractive_rng() { _M_initialize(161803398u); }
-};
-
-// Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
-// provided for backward compatibility, they are no longer part of
-// the C++ standard.
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
-mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-} // namespace __gnu_cxx
+ /// Ctor allowing you to initialize the seed.
+ subtractive_rng(unsigned int __seed)
+ { _M_initialize(__seed); }
+
+ /// Default ctor; initializes its state with some number you don't see.
+ subtractive_rng()
+ { _M_initialize(161803398u); }
+ };
+
+ // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
+ // provided for backward compatibility, they are no longer part of
+ // the C++ standard.
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun1(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+} // namespace __gnu_cxx
#endif
diff -urN libstdc++-v3-orig/include/ext/hash_fun.h libstdc++-v3/include/ext/hash_fun.h
--- libstdc++-v3-orig/include/ext/hash_fun.h 2003-12-09 05:31:53.000000000 +0100
+++ libstdc++-v3/include/ext/hash_fun.h 2004-06-12 01:15:29.000000000 +0200
@@ -1,6 +1,6 @@
// 'struct hash' from SGI -*- 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
// software; you can redistribute it and/or modify it under the
@@ -68,55 +68,105 @@
{
using std::size_t;
- template <class _Key> struct hash { };
+ template<class _Key>
+ struct hash { };
inline size_t
__stl_hash_string(const char* __s)
{
unsigned long __h = 0;
for ( ; *__s; ++__s)
- __h = 5*__h + *__s;
+ __h = 5 * __h + *__s;
return size_t(__h);
}
- template<> struct hash<char*>
- {
- size_t operator()(const char* __s) const
- { return __stl_hash_string(__s); }
- };
-
- template<> struct hash<const char*>
- {
- size_t operator()(const char* __s) const
- { return __stl_hash_string(__s); }
- };
-
- template<> struct hash<char>
- { size_t operator()(char __x) const { return __x; } };
-
- template<> struct hash<unsigned char>
- { size_t operator()(unsigned char __x) const { return __x; } };
-
- template<> struct hash<signed char>
- { size_t operator()(unsigned char __x) const { return __x; } };
-
- template<> struct hash<short>
- { size_t operator()(short __x) const { return __x; } };
-
- template<> struct hash<unsigned short>
- { size_t operator()(unsigned short __x) const { return __x; } };
-
- template<> struct hash<int>
- { size_t operator()(int __x) const { return __x; } };
-
- template<> struct hash<unsigned int>
- { size_t operator()(unsigned int __x) const { return __x; } };
-
- template<> struct hash<long>
- { size_t operator()(long __x) const { return __x; } };
-
- template<> struct hash<unsigned long>
- { size_t operator()(unsigned long __x) const { return __x; } };
+ template<>
+ struct hash<char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<const char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<char>
+ {
+ size_t
+ operator()(char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<signed char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<short>
+ {
+ size_t
+ operator()(short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned short>
+ {
+ size_t
+ operator()(unsigned short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<int>
+ {
+ size_t
+ operator()(int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned int>
+ {
+ size_t
+ operator()(unsigned int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<long>
+ {
+ size_t
+ operator()(long __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned long>
+ {
+ size_t
+ operator()(unsigned long __x) const
+ { return __x; }
+ };
} // namespace __gnu_cxx
#endif
diff -urN libstdc++-v3-orig/include/ext/iterator libstdc++-v3/include/ext/iterator
--- libstdc++-v3-orig/include/ext/iterator 2003-12-09 05:31:53.000000000 +0100
+++ libstdc++-v3/include/ext/iterator 2004-06-12 01:17:47.000000000 +0200
@@ -1,6 +1,6 @@
// HP/SGI iterator extensions -*- 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
// software; you can redistribute it and/or modify it under the
@@ -81,7 +81,11 @@
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
- while (__first != __last) { ++__first; ++__n; }
+ while (__first != __last)
+ {
+ ++__first;
+ ++__n;
+ }
}
template<typename _RandomAccessIterator, typename _Distance>
@@ -90,7 +94,8 @@
_Distance& __n, std::random_access_iterator_tag)
{
// concept requirements
- __glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
__n += __last - __first;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v3] Trivial formatting fixes
@ 2006-08-04 0:59 Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2006-08-04 0:59 UTC (permalink / raw)
To: 'gcc-patches@gcc.gnu.org'
[-- Attachment #1: Type: text/plain, Size: 76 bytes --]
Hi,
tested x86-linux, committed to mainline.
Paolo.
////////////////////
[-- Attachment #2: CL_qs_ref --]
[-- Type: text/plain, Size: 141 bytes --]
2006-08-03 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_queue.h: Trivial formatting fixes.
* include/bits/stl_stack.h: Likewise.
[-- Attachment #3: patch_qs_ref --]
[-- Type: text/plain, Size: 5275 bytes --]
Index: include/bits/stl_queue.h
===================================================================
--- include/bits/stl_queue.h (revision 115899)
+++ include/bits/stl_queue.h (working copy)
@@ -1,6 +1,6 @@
// Queue implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005
+// 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
@@ -73,11 +73,11 @@
template<typename _Tp, typename _Seq>
inline bool
- operator==(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&);
+ operator==(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
template<typename _Tp, typename _Seq>
inline bool
- operator<(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&);
+ operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&);
/**
* @brief A standard container giving FIFO behavior.
@@ -246,10 +246,9 @@
* linear in the size of the sequences, and queues are considered equivalent
* if their sequences compare equal.
*/
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator==(const queue<_Tp,_Sequence>& __x,
- const queue<_Tp,_Sequence>& __y)
+ operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return __x.c == __y.c; }
/**
@@ -265,36 +264,33 @@
* std::lexicographical_compare() is usually used to make the
* determination.
*/
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator<(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
+ operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return __x.c < __y.c; }
/// Based on operator==
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator!=(const queue<_Tp,_Sequence>& __x,
- const queue<_Tp,_Sequence>& __y)
+ operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return !(__x == __y); }
/// Based on operator<
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator>(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
+ operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return __y < __x; }
/// Based on operator<
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator<=(const queue<_Tp,_Sequence>& __x,
- const queue<_Tp,_Sequence>& __y)
+ operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return !(__y < __x); }
/// Based on operator<
- template<typename _Tp, typename _Sequence>
+ template<typename _Tp, typename _Seq>
inline bool
- operator>=(const queue<_Tp,_Sequence>& __x,
- const queue<_Tp,_Sequence>& __y)
+ operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
{ return !(__x < __y); }
/**
@@ -343,7 +339,8 @@
__glibcxx_class_requires(_Sequence, _SequenceConcept)
__glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
__glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
- __glibcxx_class_requires4(_Compare, bool, _Tp,_Tp,_BinaryFunctionConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
+ _BinaryFunctionConcept)
public:
typedef typename _Sequence::value_type value_type;
@@ -397,11 +394,13 @@
* Returns true if the %queue is empty.
*/
bool
- empty() const { return c.empty(); }
+ empty() const
+ { return c.empty(); }
/** Returns the number of elements in the %queue. */
size_type
- size() const { return c.size(); }
+ size() const
+ { return c.size(); }
/**
* Returns a read-only (constant) reference to the data at the first
Index: include/bits/stl_stack.h
===================================================================
--- include/bits/stl_stack.h (revision 115899)
+++ include/bits/stl_stack.h (working copy)
@@ -1,6 +1,7 @@
// Stack implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 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
@@ -73,11 +74,11 @@
template<typename _Tp, typename _Seq>
inline bool
- operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
+ operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y);
template<typename _Tp, typename _Seq>
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.
@@ -141,7 +142,7 @@
*/
explicit
stack(const _Sequence& __c = _Sequence())
- : c(__c) {}
+ : c(__c) { }
/**
* Returns true if the %stack is empty.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v3] Trivial formatting fixes
@ 2004-10-03 17:23 Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2004-10-03 17:23 UTC (permalink / raw)
To: 'gcc-patches@gcc.gnu.org'
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
Hi,
applied to mainline too some trivial fixes already in libstdcxx_so_7-branch
(my mistake), thus reducing the diff. Tested x86-linux.
Paolo.
///////////
[-- Attachment #2: CL_reform --]
[-- Type: text/plain, Size: 139 bytes --]
2004-10-03 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h: Trivial formatting fixes.
* include/bits/stl_tree.h: Likewise.
[-- Attachment #3: patch_reform.diff --]
[-- Type: text/plain, Size: 20566 bytes --]
diff -urN libstdc++-v3-orig/include/bits/stl_list.h libstdc++-v3/include/bits/stl_list.h
--- libstdc++-v3-orig/include/bits/stl_list.h 2004-08-02 06:40:13.000000000 +0200
+++ libstdc++-v3/include/bits/stl_list.h 2004-10-03 16:54:15.000000000 +0200
@@ -888,7 +888,7 @@
*/
void
swap(list& __x)
- { _List_node_base::swap(this->_M_impl._M_node,__x._M_impl._M_node); }
+ { _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node); }
/**
* Erases all the elements. Note that this function only erases
@@ -1115,7 +1115,7 @@
_InputIterator __first, _InputIterator __last,
__false_type)
{
- for ( ; __first != __last; ++__first)
+ for (; __first != __last; ++__first)
_M_insert(__pos, *__first);
}
@@ -1124,7 +1124,7 @@
void
_M_fill_insert(iterator __pos, size_type __n, const value_type& __x)
{
- for ( ; __n > 0; --__n)
+ for (; __n > 0; --__n)
_M_insert(__pos, __x);
}
@@ -1132,7 +1132,7 @@
// Moves the elements from [first,last) before position.
void
_M_transfer(iterator __position, iterator __first, iterator __last)
- { __position._M_node->transfer(__first._M_node,__last._M_node); }
+ { __position._M_node->transfer(__first._M_node, __last._M_node); }
// Inserts new element at position given and with value given.
void
@@ -1165,9 +1165,9 @@
*/
template<typename _Tp, typename _Alloc>
inline bool
- operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
- typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
+ typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;
const_iterator __end1 = __x.end();
const_iterator __end2 = __y.end();
@@ -1194,32 +1194,32 @@
*/
template<typename _Tp, typename _Alloc>
inline bool
- operator<(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return std::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end()); }
/// Based on operator==
template<typename _Tp, typename _Alloc>
inline bool
- operator!=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__x == __y); }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
- operator>(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return __y < __x; }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
- operator<=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__y < __x); }
/// Based on operator<
template<typename _Tp, typename _Alloc>
inline bool
- operator>=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
+ operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__x < __y); }
/// See std::list::swap().
diff -urN libstdc++-v3-orig/include/bits/stl_tree.h libstdc++-v3/include/bits/stl_tree.h
--- libstdc++-v3-orig/include/bits/stl_tree.h 2004-07-28 18:37:17.000000000 +0200
+++ libstdc++-v3/include/bits/stl_tree.h 2004-10-03 17:29:06.000000000 +0200
@@ -461,8 +461,10 @@
_Const_Link_type
_M_begin() const
- { return static_cast<
- _Const_Link_type>(this->_M_impl._M_header._M_parent); }
+ {
+ return static_cast<_Const_Link_type>
+ (this->_M_impl._M_header._M_parent);
+ }
_Link_type
_M_end()
@@ -550,7 +552,7 @@
: _M_impl(__a, __comp)
{ }
- _Rb_tree(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x)
+ _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
: _M_impl(__x.get_allocator(), __x._M_impl._M_key_compare)
{
if (__x._M_root() != 0)
@@ -565,8 +567,8 @@
~_Rb_tree()
{ _M_erase(_M_begin()); }
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>&
- operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x);
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
+ operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x);
// Accessors.
_Compare
@@ -579,7 +581,10 @@
const_iterator
begin() const
- { return static_cast<_Const_Link_type>(this->_M_impl._M_header._M_left); }
+ {
+ return static_cast<_Const_Link_type>
+ (this->_M_impl._M_header._M_left);
+ }
iterator
end()
@@ -618,7 +623,7 @@
{ return size_type(-1); }
void
- swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t);
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
// Insert/erase.
pair<iterator,bool>
@@ -699,8 +704,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator==(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{
return __x.size() == __y.size()
&& equal(__x.begin(), __x.end(), __y.begin());
@@ -709,8 +714,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator<(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
@@ -719,43 +724,43 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator!=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__x == __y); }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator>(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return __y < __x; }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator<=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__y < __x); }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline bool
- operator>=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__x < __y); }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline void
- swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x,
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y)
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ __x.swap(__y); }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>&
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
- operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x)
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
{
if (this != &__x)
{
@@ -775,16 +780,16 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
_M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
{
_Link_type __z = _M_create_node(__v);
bool __insert_left;
- __insert_left = __x != 0 || __p == _M_end()
- || _M_impl._M_key_compare(_KeyOfValue()(__v),
- _S_key(__p));
+ __insert_left = (__x != 0 || __p == _M_end()
+ || _M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key(__p)));
_Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
this->_M_impl._M_header);
@@ -794,8 +799,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_equal(const _Val& __v)
{
_Link_type __x = _M_begin();
@@ -812,8 +817,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
- swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t)
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
{
if (_M_root() == 0)
{
@@ -856,9 +861,9 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- pair<typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator,
- bool>
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator, bool>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_unique(const _Val& __v)
{
_Link_type __x = _M_begin();
@@ -877,8 +882,8 @@
else
--__j;
if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
- return pair<iterator,bool>(_M_insert(__x, __y, __v), true);
- return pair<iterator,bool>(__j, false);
+ return pair<iterator, bool>(_M_insert(__x, __y, __v), true);
+ return pair<iterator, bool>(__j, false);
}
template<typename _Key, typename _Val, typename _KeyOfValue,
@@ -929,8 +934,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_equal(iterator __position, const _Val& __v)
{
if (__position._M_node == _M_leftmost())
@@ -977,10 +982,10 @@
typename _Cmp, typename _Alloc>
template<class _II>
void
- _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>::
+ _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
insert_equal(_II __first, _II __last)
{
- for ( ; __first != __last; ++__first)
+ for (; __first != __last; ++__first)
insert_equal(*__first);
}
@@ -988,29 +993,32 @@
typename _Cmp, typename _Alloc>
template<class _II>
void
- _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>::
+ _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
insert_unique(_II __first, _II __last)
{
- for ( ; __first != __last; ++__first)
+ for (; __first != __last; ++__first)
insert_unique(*__first);
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline void
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(iterator __position)
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(iterator __position)
{
- _Link_type __y = static_cast<
- _Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node,
- this->_M_impl._M_header));
+ _Link_type __y =
+ static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
+ (__position._M_node,
+ this->_M_impl._M_header));
destroy_node(__y);
--_M_impl._M_node_count;
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x)
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const _Key& __x)
{
pair<iterator,iterator> __p = equal_range(__x);
size_type __n = std::distance(__p.first, __p.second);
@@ -1021,7 +1029,7 @@
template<typename _Key, typename _Val, typename _KoV,
typename _Compare, typename _Alloc>
typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
- _Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc>::
+ _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
_M_copy(_Const_Link_type __x, _Link_type __p)
{
// Structural copy. __x and __p must be non-null.
@@ -1057,7 +1065,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::_M_erase(_Link_type __x)
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_erase(_Link_type __x)
{
// Erase without rebalancing.
while (__x != 0)
@@ -1072,7 +1081,7 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(iterator __first, iterator __last)
{
if (__first == begin() && __last == end())
@@ -1084,7 +1093,7 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const _Key* __first, const _Key* __last)
{
while (__first != __last)
@@ -1093,8 +1102,9 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k)
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ find(const _Key& __k)
{
_Link_type __x = _M_begin(); // Current node.
_Link_type __y = _M_end(); // Last node which is not less than __k.
@@ -1106,14 +1116,15 @@
__x = _S_right(__x);
iterator __j = iterator(__y);
- return (__j == end()
- || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j;
+ return (__j == end()
+ || _M_impl._M_key_compare(__k,
+ _S_key(__j._M_node))) ? end() : __j;
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
find(const _Key& __k) const
{
_Const_Link_type __x = _M_begin(); // Current node.
@@ -1127,14 +1138,15 @@
__x = _S_right(__x);
}
const_iterator __j = const_iterator(__y);
- return (__j == end()
- || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j;
+ return (__j == end()
+ || _M_impl._M_key_compare(__k,
+ _S_key(__j._M_node))) ? end() : __j;
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
count(const _Key& __k) const
{
pair<const_iterator, const_iterator> __p = equal_range(__k);
@@ -1144,8 +1156,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
lower_bound(const _Key& __k)
{
_Link_type __x = _M_begin(); // Current node.
@@ -1162,8 +1174,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
lower_bound(const _Key& __k) const
{
_Const_Link_type __x = _M_begin(); // Current node.
@@ -1180,8 +1192,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
upper_bound(const _Key& __k)
{
_Link_type __x = _M_begin(); // Current node.
@@ -1198,8 +1210,8 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
upper_bound(const _Key& __k) const
{
_Const_Link_type __x = _M_begin(); // Current node.
@@ -1217,10 +1229,10 @@
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline
- pair<typename _Rb_tree<_Key,_Val,_KeyOfValue,
- _Compare,_Alloc>::iterator,
- typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator>
- _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::
+ pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator,
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
equal_range(const _Key& __k)
{ return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k)); }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v3] Trivial formatting fixes
@ 2004-04-21 14:03 Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2004-04-21 14:03 UTC (permalink / raw)
To: 'gcc-patches@gcc.gnu.org'
[-- Attachment #1: Type: text/plain, Size: 49 bytes --]
Hi,
tested x86-linux.
Paolo.
////////////////
[-- Attachment #2: CL_formatting --]
[-- Type: text/plain, Size: 215 bytes --]
2004-04-21 Paolo Carlini <pcarlini@suse.de>
* include/bits/deque.tcc: Trivial formatting fixes.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_tree.h: Likewise.
[-- Attachment #3: patch_formatting --]
[-- Type: text/plain, Size: 14690 bytes --]
diff -urN libstdc++-v3-orig/include/bits/deque.tcc libstdc++-v3/include/bits/deque.tcc
--- libstdc++-v3-orig/include/bits/deque.tcc 2004-04-16 21:51:33.000000000 +0200
+++ libstdc++-v3/include/bits/deque.tcc 2004-04-17 10:37:35.000000000 +0200
@@ -131,7 +131,8 @@
deque<_Tp,_Alloc>::
erase(iterator __first, iterator __last)
{
- if (__first == this->_M_impl._M_start && __last == this->_M_impl._M_finish)
+ if (__first == this->_M_impl._M_start
+ && __last == this->_M_impl._M_finish)
{
clear();
return this->_M_impl._M_finish;
@@ -139,13 +140,15 @@
else
{
const difference_type __n = __last - __first;
- const difference_type __elems_before = __first - this->_M_impl._M_start;
+ const difference_type __elems_before = (__first
+ - this->_M_impl._M_start);
if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
{
std::copy_backward(this->_M_impl._M_start, __first, __last);
iterator __new_start = this->_M_impl._M_start + __n;
std::_Destroy(this->_M_impl._M_start, __new_start);
- _M_destroy_nodes(this->_M_impl._M_start._M_node, __new_start._M_node);
+ _M_destroy_nodes(this->_M_impl._M_start._M_node,
+ __new_start._M_node);
this->_M_impl._M_start = __new_start;
}
else
@@ -176,12 +179,15 @@
if (this->_M_impl._M_start._M_node != this->_M_impl._M_finish._M_node)
{
- std::_Destroy(this->_M_impl._M_start._M_cur, this->_M_impl._M_start._M_last);
- std::_Destroy(this->_M_impl._M_finish._M_first, this->_M_impl._M_finish._M_cur);
+ std::_Destroy(this->_M_impl._M_start._M_cur,
+ this->_M_impl._M_start._M_last);
+ std::_Destroy(this->_M_impl._M_finish._M_first,
+ this->_M_impl._M_finish._M_cur);
_M_deallocate_node(this->_M_impl._M_finish._M_first);
}
else
- std::_Destroy(this->_M_impl._M_start._M_cur, this->_M_impl._M_finish._M_cur);
+ std::_Destroy(this->_M_impl._M_start._M_cur,
+ this->_M_impl._M_finish._M_cur);
this->_M_impl._M_finish = this->_M_impl._M_start;
}
@@ -217,7 +223,8 @@
}
catch(...)
{
- _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node);
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
__throw_exception_again;
}
}
@@ -226,7 +233,8 @@
iterator __new_finish = _M_reserve_elements_at_back(__n);
try
{
- std::uninitialized_fill(this->_M_impl._M_finish, __new_finish, __x);
+ std::uninitialized_fill(this->_M_impl._M_finish,
+ __new_finish, __x);
this->_M_impl._M_finish = __new_finish;
}
catch(...)
@@ -305,11 +313,13 @@
std::uninitialized_copy(__first, __mid, *__cur_node);
__first = __mid;
}
- std::uninitialized_copy(__first, __last, this->_M_impl._M_finish._M_first);
+ std::uninitialized_copy(__first, __last,
+ this->_M_impl._M_finish._M_first);
}
catch(...)
{
- std::_Destroy(this->_M_impl._M_start, iterator(*__cur_node, __cur_node));
+ std::_Destroy(this->_M_impl._M_start,
+ iterator(*__cur_node, __cur_node));
__throw_exception_again;
}
}
@@ -326,7 +336,8 @@
try
{
std::_Construct(this->_M_impl._M_finish._M_cur, __t_copy);
- this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node + 1);
+ this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
+ + 1);
this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
}
catch(...)
@@ -347,7 +358,8 @@
*(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
try
{
- this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node - 1);
+ this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
+ - 1);
this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
std::_Construct(this->_M_impl._M_start._M_cur, __t_copy);
}
@@ -370,10 +382,11 @@
std::_Destroy(this->_M_impl._M_finish._M_cur);
}
- // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1. Note that
- // if the deque has at least one element (a precondition for this member
- // function), and if _M_impl._M_start._M_cur == _M_impl._M_start._M_last, then the deque
- // must have at least two nodes.
+ // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1.
+ // Note that if the deque has at least one element (a precondition for this
+ // member function), and if
+ // _M_impl._M_start._M_cur == _M_impl._M_start._M_last,
+ // then the deque must have at least two nodes.
template <typename _Tp, typename _Alloc>
void deque<_Tp,_Alloc>::
_M_pop_front_aux()
@@ -412,7 +425,8 @@
}
catch(...)
{
- _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node);
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
__throw_exception_again;
}
}
@@ -421,7 +435,8 @@
iterator __new_finish = _M_reserve_elements_at_back(__n);
try
{
- std::uninitialized_copy(__first, __last, this->_M_impl._M_finish);
+ std::uninitialized_copy(__first, __last,
+ this->_M_impl._M_finish);
this->_M_impl._M_finish = __new_finish;
}
catch(...)
@@ -485,7 +500,8 @@
{
if (__elems_before >= difference_type(__n))
{
- iterator __start_n = this->_M_impl._M_start + difference_type(__n);
+ iterator __start_n = (this->_M_impl._M_start
+ + difference_type(__n));
std::uninitialized_copy(this->_M_impl._M_start, __start_n,
__new_start);
this->_M_impl._M_start = __new_start;
@@ -494,16 +510,18 @@
}
else
{
- std::__uninitialized_copy_fill(this->_M_impl._M_start, __pos,
- __new_start,
- this->_M_impl._M_start, __x_copy);
+ std::__uninitialized_copy_fill(this->_M_impl._M_start,
+ __pos, __new_start,
+ this->_M_impl._M_start,
+ __x_copy);
this->_M_impl._M_start = __new_start;
std::fill(__old_start, __pos, __x_copy);
}
}
catch(...)
{
- _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node);
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
__throw_exception_again;
}
}
@@ -518,7 +536,8 @@
{
if (__elems_after > difference_type(__n))
{
- iterator __finish_n = this->_M_impl._M_finish - difference_type(__n);
+ iterator __finish_n = (this->_M_impl._M_finish
+ - difference_type(__n));
std::uninitialized_copy(__finish_n, this->_M_impl._M_finish,
this->_M_impl._M_finish);
this->_M_impl._M_finish = __new_finish;
@@ -563,7 +582,8 @@
{
if (__elemsbefore >= difference_type(__n))
{
- iterator __start_n = this->_M_impl._M_start + difference_type(__n);
+ iterator __start_n = (this->_M_impl._M_start
+ + difference_type(__n));
std::uninitialized_copy(this->_M_impl._M_start, __start_n,
__new_start);
this->_M_impl._M_start = __new_start;
@@ -574,15 +594,17 @@
{
_ForwardIterator __mid = __first;
std::advance(__mid, difference_type(__n) - __elemsbefore);
- std::__uninitialized_copy_copy(this->_M_impl._M_start, __pos,
- __first, __mid, __new_start);
+ std::__uninitialized_copy_copy(this->_M_impl._M_start,
+ __pos, __first, __mid,
+ __new_start);
this->_M_impl._M_start = __new_start;
std::copy(__mid, __last, __old_start);
}
}
catch(...)
{
- _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node);
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
__throw_exception_again;
}
}
@@ -597,7 +619,8 @@
{
if (__elemsafter > difference_type(__n))
{
- iterator __finish_n = this->_M_impl._M_finish - difference_type(__n);
+ iterator __finish_n = (this->_M_impl._M_finish
+ - difference_type(__n));
std::uninitialized_copy(__finish_n,
this->_M_impl._M_finish,
this->_M_impl._M_finish);
diff -urN libstdc++-v3-orig/include/bits/stl_deque.h libstdc++-v3/include/bits/stl_deque.h
--- libstdc++-v3-orig/include/bits/stl_deque.h 2004-04-16 21:51:33.000000000 +0200
+++ libstdc++-v3/include/bits/stl_deque.h 2004-04-17 10:44:19.000000000 +0200
@@ -359,15 +359,15 @@
get_allocator() const
{ return *static_cast<const _Alloc*>(&this->_M_impl); }
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
+ typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
_Deque_base(const allocator_type& __a, size_t __num_elements)
- : _M_impl(__a)
+ : _M_impl(__a)
{ _M_initialize_map(__num_elements); }
_Deque_base(const allocator_type& __a)
- : _M_impl(__a)
+ : _M_impl(__a)
{ }
~_Deque_base();
@@ -377,14 +377,15 @@
//standard container and at the same time makes use of the EBO
//for empty allocators.
struct _Deque_impl
- : public _Alloc {
+ : public _Alloc
+ {
_Tp** _M_map;
size_t _M_map_size;
iterator _M_start;
iterator _M_finish;
_Deque_impl(const _Alloc& __a)
- : _Alloc(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish()
+ : _Alloc(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish()
{ }
};
@@ -422,7 +423,8 @@
{
if (this->_M_impl._M_map)
{
- _M_destroy_nodes(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1);
+ _M_destroy_nodes(this->_M_impl._M_start._M_node,
+ this->_M_impl._M_finish._M_node + 1);
_M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
}
}
@@ -452,7 +454,8 @@
// the beginning of _M_map, but for small maps it may be as far in as
// _M_map+3.
- _Tp** __nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size - __num_nodes) / 2;
+ _Tp** __nstart = (this->_M_impl._M_map
+ + (this->_M_impl._M_map_size - __num_nodes) / 2);
_Tp** __nfinish = __nstart + __num_nodes;
try
@@ -468,8 +471,9 @@
this->_M_impl._M_start._M_set_node(__nstart);
this->_M_impl._M_finish._M_set_node(__nfinish - 1);
this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first;
- this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first + __num_elements
- % __deque_buf_size(sizeof(_Tp));
+ this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first
+ + __num_elements
+ % __deque_buf_size(sizeof(_Tp)));
}
template<typename _Tp, typename _Alloc>
@@ -668,7 +672,8 @@
*/
deque(const deque& __x)
: _Base(__x.get_allocator(), __x.size())
- { std::uninitialized_copy(__x.begin(), __x.end(), this->_M_impl._M_start); }
+ { std::uninitialized_copy(__x.begin(), __x.end(),
+ this->_M_impl._M_start); }
/**
* @brief Builds a %deque from a range.
@@ -1009,7 +1014,8 @@
void
push_back(const value_type& __x)
{
- if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_last - 1)
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_last - 1)
{
std::_Construct(this->_M_impl._M_finish._M_cur, __x);
++this->_M_impl._M_finish._M_cur;
@@ -1029,7 +1035,8 @@
void
pop_front()
{
- if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_last - 1)
+ if (this->_M_impl._M_start._M_cur
+ != this->_M_impl._M_start._M_last - 1)
{
std::_Destroy(this->_M_impl._M_start._M_cur);
++this->_M_impl._M_start._M_cur;
@@ -1049,7 +1056,8 @@
void
pop_back()
{
- if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_first)
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_first)
{
--this->_M_impl._M_finish._M_cur;
std::_Destroy(this->_M_impl._M_finish._M_cur);
@@ -1418,7 +1426,8 @@
void
_M_reserve_map_at_front (size_type __nodes_to_add = 1)
{
- if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node - this->_M_impl._M_map))
+ if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node
+ - this->_M_impl._M_map))
_M_reallocate_map(__nodes_to_add, true);
}
diff -urN libstdc++-v3-orig/include/bits/stl_list.h libstdc++-v3/include/bits/stl_list.h
--- libstdc++-v3-orig/include/bits/stl_list.h 2004-04-16 21:51:33.000000000 +0200
+++ libstdc++-v3/include/bits/stl_list.h 2004-04-17 10:46:31.000000000 +0200
@@ -295,10 +295,11 @@
_Node_Alloc_type;
struct _List_impl
- : public _Node_Alloc_type {
+ : public _Node_Alloc_type
+ {
_List_node_base _M_node;
_List_impl (const _Node_Alloc_type& __a)
- : _Node_Alloc_type(__a)
+ : _Node_Alloc_type(__a)
{ }
};
@@ -317,10 +318,11 @@
allocator_type
get_allocator() const
- { return allocator_type(*static_cast<const _Node_Alloc_type*>(&this->_M_impl)); }
+ { return allocator_type(*static_cast<
+ const _Node_Alloc_type*>(&this->_M_impl)); }
_List_base(const allocator_type& __a)
- : _M_impl(__a)
+ : _M_impl(__a)
{ _M_init(); }
// This is what actually destroys the list.
diff -urN libstdc++-v3-orig/include/bits/stl_tree.h libstdc++-v3/include/bits/stl_tree.h
--- libstdc++-v3-orig/include/bits/stl_tree.h 2004-03-30 23:04:19.000000000 +0200
+++ libstdc++-v3/include/bits/stl_tree.h 2004-04-17 10:50:46.000000000 +0200
@@ -461,7 +461,8 @@
_Const_Link_type
_M_begin() const
- { return static_cast<_Const_Link_type>(this->_M_impl._M_header._M_parent); }
+ { return static_cast<
+ _Const_Link_type>(this->_M_impl._M_header._M_parent); }
_Link_type
_M_end()
@@ -999,9 +1000,9 @@
inline void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(iterator __position)
{
- _Link_type __y =
- static_cast<_Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node,
- this->_M_impl._M_header));
+ _Link_type __y = static_cast<
+ _Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node,
+ this->_M_impl._M_header));
destroy_node(__y);
--_M_impl._M_node_count;
}
@@ -1278,4 +1279,3 @@
} // namespace std
#endif
-
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-08-03 21:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-12 12:30 [v3] Trivial formatting fixes Paolo Carlini
-- strict thread matches above, loose matches on Subject: below --
2006-08-04 0:59 Paolo Carlini
2004-10-03 17:23 Paolo Carlini
2004-04-21 14:03 Paolo Carlini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).