Commit f6592a9e by Paolo Carlini Committed by Paolo Carlini

deque.tcc: Wrap overlong lines...

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

	* include/bits/deque.tcc: Wrap overlong lines, constify
	a few variables, reformat according to the coding standards.
	* include/bits/list.tcc: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_function.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_relops.h: Likewise.
	* include/bits/stl_set.h: Likewise.

From-SVN: r77077
parent e0a24727
2004-02-01 Paolo Carlini <pcarlini@suse.de> 2004-02-01 Paolo Carlini <pcarlini@suse.de>
* include/bits/deque.tcc: Wrap overlong lines, constify
a few variables, reformat according to the coding standards.
* include/bits/list.tcc: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_function.h: Likewise.
* include/bits/stl_iterator.h: Likewise.
* include/bits/stl_iterator_base_funcs.h: Likewise.
* include/bits/stl_iterator_base_types.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_relops.h: Likewise.
* include/bits/stl_set.h: Likewise.
2004-02-01 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h: Wrap overlong lines, constify * include/bits/stl_bvector.h: Wrap overlong lines, constify
a few variables, reformat according to the coding standards. a few variables, reformat according to the coding standards.
* include/bits/stl_tree.h: Likewise. * include/bits/stl_tree.h: Likewise.
......
// List implementation (out of line) -*- C++ -*- // List implementation (out of line) -*- 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
...@@ -120,18 +120,18 @@ namespace __gnu_norm ...@@ -120,18 +120,18 @@ namespace __gnu_norm
operator=(const list& __x) operator=(const list& __x)
{ {
if (this != &__x) if (this != &__x)
{ {
iterator __first1 = begin(); iterator __first1 = begin();
iterator __last1 = end(); iterator __last1 = end();
const_iterator __first2 = __x.begin(); const_iterator __first2 = __x.begin();
const_iterator __last2 = __x.end(); const_iterator __last2 = __x.end();
while (__first1 != __last1 && __first2 != __last2) while (__first1 != __last1 && __first2 != __last2)
*__first1++ = *__first2++; *__first1++ = *__first2++;
if (__first2 == __last2) if (__first2 == __last2)
erase(__first1, __last1); erase(__first1, __last1);
else else
insert(__last1, __first2, __last2); insert(__last1, __first2, __last2);
} }
return *this; return *this;
} }
...@@ -191,7 +191,8 @@ namespace __gnu_norm ...@@ -191,7 +191,8 @@ namespace __gnu_norm
{ {
iterator __first = begin(); iterator __first = begin();
iterator __last = end(); iterator __last = end();
if (__first == __last) return; if (__first == __last)
return;
iterator __next = __first; iterator __next = __first;
while (++__next != __last) while (++__next != __last)
{ {
...@@ -245,19 +246,21 @@ namespace __gnu_norm ...@@ -245,19 +246,21 @@ namespace __gnu_norm
list * __counter; list * __counter;
do do
{ {
__carry.splice(__carry.begin(), *this, begin()); __carry.splice(__carry.begin(), *this, begin());
for(__counter = &__tmp[0]; for(__counter = &__tmp[0];
(__counter != __fill) && !__counter->empty(); (__counter != __fill) && !__counter->empty();
++__counter) ++__counter)
{ {
__counter->merge(__carry); __counter->merge(__carry);
__carry.swap(*__counter); __carry.swap(*__counter);
} }
__carry.swap(*__counter); __carry.swap(*__counter);
if (__counter == __fill) ++__fill; if (__counter == __fill)
} while ( !empty() ); ++__fill;
}
while ( !empty() );
for (__counter = &__tmp[1]; __counter != __fill; ++__counter) for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
__counter->merge( *(__counter-1) ); __counter->merge( *(__counter-1) );
...@@ -277,7 +280,8 @@ namespace __gnu_norm ...@@ -277,7 +280,8 @@ namespace __gnu_norm
{ {
iterator __next = __first; iterator __next = __first;
++__next; ++__next;
if (__pred(*__first)) _M_erase(__first); if (__pred(*__first))
_M_erase(__first);
__first = __next; __first = __next;
} }
} }
...@@ -332,39 +336,41 @@ namespace __gnu_norm ...@@ -332,39 +336,41 @@ namespace __gnu_norm
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _StrictWeakOrdering> template <typename _StrictWeakOrdering>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
sort(_StrictWeakOrdering __comp) sort(_StrictWeakOrdering __comp)
{
// Do nothing if the list has length 0 or 1.
if (this->_M_node._M_next != &this->_M_node &&
this->_M_node._M_next->_M_next != &this->_M_node)
{ {
list __carry; // Do nothing if the list has length 0 or 1.
list __tmp[64]; if (this->_M_node._M_next != &this->_M_node
list * __fill = &__tmp[0]; && this->_M_node._M_next->_M_next != &this->_M_node)
list * __counter; {
list __carry;
do list __tmp[64];
{ list * __fill = &__tmp[0];
__carry.splice(__carry.begin(), *this, begin()); list * __counter;
for(__counter = &__tmp[0]; do
(__counter != __fill) && !__counter->empty(); {
++__counter) __carry.splice(__carry.begin(), *this, begin());
{
__counter->merge(__carry, __comp); for(__counter = &__tmp[0];
__carry.swap(*__counter); (__counter != __fill) && !__counter->empty();
} ++__counter)
__carry.swap(*__counter); {
if (__counter == __fill) ++__fill; __counter->merge(__carry, __comp);
} while ( !empty() ); __carry.swap(*__counter);
}
for (__counter = &__tmp[1]; __counter != __fill; ++__counter) __carry.swap(*__counter);
__counter->merge( *(__counter-1), __comp ); if (__counter == __fill)
swap( *(__fill-1) ); ++__fill;
}
while ( !empty() );
for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
__counter->merge( *(__counter-1), __comp );
swap( *(__fill-1) );
}
} }
}
} // namespace __gnu_norm } // namespace __gnu_norm
#endif /* _LIST_TCC */ #endif /* _LIST_TCC */
......
// Functions used by iterators -*- C++ -*- // Functions used by iterators -*- 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
...@@ -78,9 +78,11 @@ namespace std ...@@ -78,9 +78,11 @@ namespace std
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
typename iterator_traits<_InputIterator>::difference_type __n = 0; typename iterator_traits<_InputIterator>::difference_type __n = 0;
while (__first != __last) { while (__first != __last)
++__first; ++__n; {
} ++__first;
++__n;
}
return __n; return __n;
} }
...@@ -90,7 +92,8 @@ namespace std ...@@ -90,7 +92,8 @@ namespace std
random_access_iterator_tag) random_access_iterator_tag)
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>) __glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
return __last - __first; return __last - __first;
} }
...@@ -111,7 +114,8 @@ namespace std ...@@ -111,7 +114,8 @@ namespace std
distance(_InputIterator __first, _InputIterator __last) distance(_InputIterator __first, _InputIterator __last)
{ {
// concept requirements -- taken care of in __distance // concept requirements -- taken care of in __distance
return std::__distance(__first, __last, std::__iterator_category(__first)); return std::__distance(__first, __last,
std::__iterator_category(__first));
} }
template<typename _InputIterator, typename _Distance> template<typename _InputIterator, typename _Distance>
...@@ -120,7 +124,8 @@ namespace std ...@@ -120,7 +124,8 @@ namespace std
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
while (__n--) ++__i; while (__n--)
++__i;
} }
template<typename _BidirectionalIterator, typename _Distance> template<typename _BidirectionalIterator, typename _Distance>
...@@ -129,8 +134,8 @@ namespace std ...@@ -129,8 +134,8 @@ namespace std
bidirectional_iterator_tag) bidirectional_iterator_tag)
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_BidirectionalIteratorConcept<_BidirectionalIterator>) __glibcxx_function_requires(_BidirectionalIteratorConcept<
_BidirectionalIterator>)
if (__n > 0) if (__n > 0)
while (__n--) ++__i; while (__n--) ++__i;
else else
...@@ -143,7 +148,8 @@ namespace std ...@@ -143,7 +148,8 @@ namespace std
random_access_iterator_tag) random_access_iterator_tag)
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>) __glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__i += __n; __i += __n;
} }
......
// Types used in iterator implementation -*- C++ -*- // Types used in iterator 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
...@@ -82,9 +82,11 @@ namespace std ...@@ -82,9 +82,11 @@ namespace std
struct output_iterator_tag {}; struct output_iterator_tag {};
/// Forward iterators support a superset of input iterator operations. /// Forward iterators support a superset of input iterator operations.
struct forward_iterator_tag : public input_iterator_tag {}; struct forward_iterator_tag : public input_iterator_tag {};
/// Bidirectional iterators support a superset of forward iterator operations. /// Bidirectional iterators support a superset of forward iterator
/// operations.
struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {};
/// Random-access iterators support a superset of bidirectional iterator operations. /// Random-access iterators support a superset of bidirectional iterator
/// operations.
struct random_access_iterator_tag : public bidirectional_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {};
//@} //@}
......
...@@ -94,7 +94,6 @@ namespace __gnu_norm ...@@ -94,7 +94,6 @@ namespace __gnu_norm
_Tp _M_data; ///< User's data. _Tp _M_data; ///< User's data.
}; };
/** /**
* @brief A list::iterator. * @brief A list::iterator.
* *
...@@ -325,7 +324,6 @@ namespace __gnu_norm ...@@ -325,7 +324,6 @@ namespace __gnu_norm
} }
}; };
/** /**
* @brief A standard container with linear time access to elements, * @brief A standard container with linear time access to elements,
* and fixed time insertion/deletion at any point in the sequence. * and fixed time insertion/deletion at any point in the sequence.
...@@ -573,7 +571,8 @@ namespace __gnu_norm ...@@ -573,7 +571,8 @@ namespace __gnu_norm
/// Get a copy of the memory allocation object. /// Get a copy of the memory allocation object.
allocator_type allocator_type
get_allocator() const { return _Base::get_allocator(); } get_allocator() const
{ return _Base::get_allocator(); }
// iterators // iterators
/** /**
...@@ -581,7 +580,8 @@ namespace __gnu_norm ...@@ -581,7 +580,8 @@ namespace __gnu_norm
* %list. Iteration is done in ordinary element order. * %list. Iteration is done in ordinary element order.
*/ */
iterator iterator
begin() { return this->_M_node._M_next; } begin()
{ return this->_M_node._M_next; }
/** /**
* Returns a read-only (constant) iterator that points to the * Returns a read-only (constant) iterator that points to the
...@@ -589,7 +589,8 @@ namespace __gnu_norm ...@@ -589,7 +589,8 @@ namespace __gnu_norm
* element order. * element order.
*/ */
const_iterator const_iterator
begin() const { return this->_M_node._M_next; } begin() const
{ return this->_M_node._M_next; }
/** /**
* Returns a read/write iterator that points one past the last * Returns a read/write iterator that points one past the last
...@@ -605,7 +606,8 @@ namespace __gnu_norm ...@@ -605,7 +606,8 @@ namespace __gnu_norm
* element order. * element order.
*/ */
const_iterator const_iterator
end() const { return &this->_M_node; } end() const
{ return &this->_M_node; }
/** /**
* Returns a read/write reverse iterator that points to the last * Returns a read/write reverse iterator that points to the last
...@@ -613,7 +615,8 @@ namespace __gnu_norm ...@@ -613,7 +615,8 @@ namespace __gnu_norm
* order. * order.
*/ */
reverse_iterator reverse_iterator
rbegin() { return reverse_iterator(end()); } rbegin()
{ return reverse_iterator(end()); }
/** /**
* Returns a read-only (constant) reverse iterator that points to * Returns a read-only (constant) reverse iterator that points to
...@@ -621,7 +624,8 @@ namespace __gnu_norm ...@@ -621,7 +624,8 @@ namespace __gnu_norm
* element order. * element order.
*/ */
const_reverse_iterator const_reverse_iterator
rbegin() const { return const_reverse_iterator(end()); } rbegin() const
{ return const_reverse_iterator(end()); }
/** /**
* Returns a read/write reverse iterator that points to one * Returns a read/write reverse iterator that points to one
...@@ -629,7 +633,8 @@ namespace __gnu_norm ...@@ -629,7 +633,8 @@ namespace __gnu_norm
* reverse element order. * reverse element order.
*/ */
reverse_iterator reverse_iterator
rend() { return reverse_iterator(begin()); } rend()
{ return reverse_iterator(begin()); }
/** /**
* Returns a read-only (constant) reverse iterator that points to one * Returns a read-only (constant) reverse iterator that points to one
...@@ -646,15 +651,18 @@ namespace __gnu_norm ...@@ -646,15 +651,18 @@ namespace __gnu_norm
* end().) * end().)
*/ */
bool bool
empty() const { return this->_M_node._M_next == &this->_M_node; } empty() const
{ return this->_M_node._M_next == &this->_M_node; }
/** Returns the number of elements in the %list. */ /** Returns the number of elements in the %list. */
size_type size_type
size() const { return std::distance(begin(), end()); } size() const
{ return std::distance(begin(), end()); }
/** Returns the size() of the largest possible %list. */ /** Returns the size() of the largest possible %list. */
size_type size_type
max_size() const { return size_type(-1); } max_size() const
{ return size_type(-1); }
/** /**
* @brief Resizes the %list to the specified number of elements. * @brief Resizes the %list to the specified number of elements.
...@@ -679,7 +687,8 @@ namespace __gnu_norm ...@@ -679,7 +687,8 @@ namespace __gnu_norm
* and new elements are default-constructed. * and new elements are default-constructed.
*/ */
void void
resize(size_type __new_size) { this->resize(__new_size, value_type()); } resize(size_type __new_size)
{ this->resize(__new_size, value_type()); }
// element access // element access
/** /**
...@@ -687,28 +696,32 @@ namespace __gnu_norm ...@@ -687,28 +696,32 @@ namespace __gnu_norm
* element of the %list. * element of the %list.
*/ */
reference reference
front() { return *begin(); } front()
{ return *begin(); }
/** /**
* Returns a read-only (constant) reference to the data at the first * Returns a read-only (constant) reference to the data at the first
* element of the %list. * element of the %list.
*/ */
const_reference const_reference
front() const { return *begin(); } front() const
{ return *begin(); }
/** /**
* Returns a read/write reference to the data at the last element * Returns a read/write reference to the data at the last element
* of the %list. * of the %list.
*/ */
reference reference
back() { return *(--end()); } back()
{ return *(--end()); }
/** /**
* Returns a read-only (constant) reference to the data at the last * Returns a read-only (constant) reference to the data at the last
* element of the %list. * element of the %list.
*/ */
const_reference const_reference
back() const { return *(--end()); } back() const
{ return *(--end()); }
// [23.2.2.3] modifiers // [23.2.2.3] modifiers
/** /**
...@@ -722,7 +735,8 @@ namespace __gnu_norm ...@@ -722,7 +735,8 @@ namespace __gnu_norm
* references. * references.
*/ */
void void
push_front(const value_type& __x) { this->_M_insert(begin(), __x); } push_front(const value_type& __x)
{ this->_M_insert(begin(), __x); }
/** /**
* @brief Removes first element. * @brief Removes first element.
...@@ -737,7 +751,8 @@ namespace __gnu_norm ...@@ -737,7 +751,8 @@ namespace __gnu_norm
* called. * called.
*/ */
void void
pop_front() { this->_M_erase(begin()); } pop_front()
{ this->_M_erase(begin()); }
/** /**
* @brief Add data to the end of the %list. * @brief Add data to the end of the %list.
...@@ -750,7 +765,8 @@ namespace __gnu_norm ...@@ -750,7 +765,8 @@ namespace __gnu_norm
* references. * references.
*/ */
void void
push_back(const value_type& __x) { this->_M_insert(end(), __x); } push_back(const value_type& __x)
{ this->_M_insert(end(), __x); }
/** /**
* @brief Removes last element. * @brief Removes last element.
...@@ -764,7 +780,8 @@ namespace __gnu_norm ...@@ -764,7 +780,8 @@ namespace __gnu_norm
* is needed, it should be retrieved before pop_back() is called. * is needed, it should be retrieved before pop_back() is called.
*/ */
void void
pop_back() { this->_M_erase(this->_M_node._M_prev); } pop_back()
{ this->_M_erase(this->_M_node._M_prev); }
/** /**
* @brief Inserts given value into %list before specified iterator. * @brief Inserts given value into %list before specified iterator.
...@@ -876,7 +893,8 @@ namespace __gnu_norm ...@@ -876,7 +893,8 @@ namespace __gnu_norm
* function. * function.
*/ */
void void
swap(list& __x) { _List_node_base::swap(this->_M_node,__x._M_node); } swap(list& __x)
{ _List_node_base::swap(this->_M_node,__x._M_node); }
/** /**
* Erases all the elements. Note that this function only erases * Erases all the elements. Note that this function only erases
...@@ -922,7 +940,8 @@ namespace __gnu_norm ...@@ -922,7 +940,8 @@ namespace __gnu_norm
{ {
iterator __j = __i; iterator __j = __i;
++__j; ++__j;
if (__position == __i || __position == __j) return; if (__position == __i || __position == __j)
return;
this->_M_transfer(__position, __i, __j); this->_M_transfer(__position, __i, __j);
} }
...@@ -1037,7 +1056,8 @@ namespace __gnu_norm ...@@ -1037,7 +1056,8 @@ namespace __gnu_norm
* Reverse the order of elements in the list in linear time. * Reverse the order of elements in the list in linear time.
*/ */
void void
reverse() { this->_M_node.reverse(); } reverse()
{ this->_M_node.reverse(); }
/** /**
* @brief Sort the elements. * @brief Sort the elements.
...@@ -1118,16 +1138,13 @@ namespace __gnu_norm ...@@ -1118,16 +1138,13 @@ namespace __gnu_norm
// Moves the elements from [first,last) before position. // Moves the elements from [first,last) before position.
void void
_M_transfer(iterator __position, iterator __first, iterator __last) _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. // Inserts new element at position given and with value given.
void void
_M_insert(iterator __position, const value_type& __x) _M_insert(iterator __position, const value_type& __x)
{ {
_Node* __tmp = _M_create_node(__x); _Node* __tmp = _M_create_node(__x);
__tmp->hook(__position._M_node); __tmp->hook(__position._M_node);
} }
...@@ -1142,7 +1159,6 @@ namespace __gnu_norm ...@@ -1142,7 +1159,6 @@ namespace __gnu_norm
} }
}; };
/** /**
* @brief List equality comparison. * @brief List equality comparison.
* @param x A %list. * @param x A %list.
...@@ -1167,7 +1183,7 @@ namespace __gnu_norm ...@@ -1167,7 +1183,7 @@ namespace __gnu_norm
{ {
++__i1; ++__i1;
++__i2; ++__i2;
} }
return __i1 == __end1 && __i2 == __end2; return __i1 == __end1 && __i2 == __end2;
} }
...@@ -1185,10 +1201,8 @@ namespace __gnu_norm ...@@ -1185,10 +1201,8 @@ namespace __gnu_norm
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(),
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); }
__y.begin(), __y.end());
}
/// Based on operator== /// Based on operator==
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
......
// std::rel_ops implementation -*- C++ -*- // std::rel_ops 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
...@@ -75,61 +75,61 @@ namespace std ...@@ -75,61 +75,61 @@ namespace std
{ {
namespace rel_ops namespace rel_ops
{ {
/** @namespace std::rel_ops /** @namespace std::rel_ops
* @brief The generated relational operators are sequestered here. * @brief The generated relational operators are sequestered here.
*/ */
/**
* @brief Defines @c != for arbitrary types, in terms of @c ==.
* @param x A thing.
* @param y Another thing.
* @return x != y
*
* This function uses @c == to determine its result.
*/
template <class _Tp>
inline bool
operator!=(const _Tp& __x, const _Tp& __y)
{ return !(__x == __y); }
/** /**
* @brief Defines @c != for arbitrary types, in terms of @c ==. * @brief Defines @c > for arbitrary types, in terms of @c <.
* @param x A thing. * @param x A thing.
* @param y Another thing. * @param y Another thing.
* @return x != y * @return x > y
* *
* This function uses @c == to determine its result. * This function uses @c < to determine its result.
*/ */
template <class _Tp> template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) { inline bool
return !(__x == __y); operator>(const _Tp& __x, const _Tp& __y)
} { return __y < __x; }
/** /**
* @brief Defines @c > for arbitrary types, in terms of @c <. * @brief Defines @c <= for arbitrary types, in terms of @c <.
* @param x A thing. * @param x A thing.
* @param y Another thing. * @param y Another thing.
* @return x > y * @return x <= y
* *
* This function uses @c < to determine its result. * This function uses @c < to determine its result.
*/ */
template <class _Tp> template <class _Tp>
inline bool operator>(const _Tp& __x, const _Tp& __y) { inline bool
return __y < __x; operator<=(const _Tp& __x, const _Tp& __y)
} { return !(__y < __x); }
/** /**
* @brief Defines @c <= for arbitrary types, in terms of @c <. * @brief Defines @c >= for arbitrary types, in terms of @c <.
* @param x A thing. * @param x A thing.
* @param y Another thing. * @param y Another thing.
* @return x <= y * @return x >= y
* *
* This function uses @c < to determine its result. * This function uses @c < to determine its result.
*/ */
template <class _Tp> template <class _Tp>
inline bool operator<=(const _Tp& __x, const _Tp& __y) { inline bool
return !(__y < __x); operator>=(const _Tp& __x, const _Tp& __y)
} { return !(__x < __y); }
/**
* @brief Defines @c >= for arbitrary types, in terms of @c <.
* @param x A thing.
* @param y Another thing.
* @return x >= y
*
* This function uses @c < to determine its result.
*/
template <class _Tp>
inline bool operator>=(const _Tp& __x, const _Tp& __y) {
return !(__x < __y);
}
} // namespace rel_ops } // namespace rel_ops
} // namespace std } // namespace std
......
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