Commit 3971a4d2 by Phil Edwards

deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.

2002-08-09  Phil Edwards  <pme@gcc.gnu.org>

	* include/bits/deque.tcc, include/bits/list.tcc,
	include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
	include/bits/stl_list.h, include/bits/stl_map.h,
	include/bits/stl_multimap.h, include/bits/stl_queue.h,
	include/bits/stl_stack.h, include/bits/stl_vector.h,
	include/bits/vector.tcc:  Re-indent contents of namespace std,
	re-wrap comment lines as necessary.

From-SVN: r56165
parent 2043c38e
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
2002-08-08 Danny Smith <dannysmith@users.sourceforge.net> 2002-08-08 Danny Smith <dannysmith@users.sourceforge.net>
Benjamin Kosnik <bkoz@redhat.com> Benjamin Kosnik <bkoz@redhat.com>
......
...@@ -61,13 +61,9 @@ ...@@ -61,13 +61,9 @@
#ifndef __GLIBCPP_INTERNAL_DEQUE_TCC #ifndef __GLIBCPP_INTERNAL_DEQUE_TCC
#define __GLIBCPP_INTERNAL_DEQUE_TCC #define __GLIBCPP_INTERNAL_DEQUE_TCC
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
template <typename _Tp, typename _Alloc>
template <typename _Tp, typename _Alloc>
deque<_Tp,_Alloc>& deque<_Tp,_Alloc>&
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
operator=(const deque& __x) operator=(const deque& __x)
...@@ -87,7 +83,7 @@ template <typename _Tp, typename _Alloc> ...@@ -87,7 +83,7 @@ template <typename _Tp, typename _Alloc>
return *this; return *this;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename deque<_Tp,_Alloc>::iterator typename deque<_Tp,_Alloc>::iterator
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
insert(iterator position, const value_type& __x) insert(iterator position, const value_type& __x)
...@@ -108,7 +104,7 @@ template <typename _Tp, typename _Alloc> ...@@ -108,7 +104,7 @@ template <typename _Tp, typename _Alloc>
return _M_insert_aux(position, __x); return _M_insert_aux(position, __x);
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename deque<_Tp,_Alloc>::iterator typename deque<_Tp,_Alloc>::iterator
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
erase(iterator __position) erase(iterator __position)
...@@ -129,7 +125,7 @@ template <typename _Tp, typename _Alloc> ...@@ -129,7 +125,7 @@ template <typename _Tp, typename _Alloc>
return _M_start + __index; return _M_start + __index;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename deque<_Tp,_Alloc>::iterator typename deque<_Tp,_Alloc>::iterator
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
...@@ -163,7 +159,7 @@ template <typename _Tp, typename _Alloc> ...@@ -163,7 +159,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
clear() clear()
...@@ -188,7 +184,7 @@ template <typename _Tp, typename _Alloc> ...@@ -188,7 +184,7 @@ template <typename _Tp, typename _Alloc>
_M_finish = _M_start; _M_finish = _M_start;
} }
template <typename _Tp, class _Alloc> template <typename _Tp, class _Alloc>
template <typename _InputIter> template <typename _InputIter>
void void
deque<_Tp,_Alloc> deque<_Tp,_Alloc>
...@@ -203,7 +199,7 @@ template <typename _Tp, class _Alloc> ...@@ -203,7 +199,7 @@ template <typename _Tp, class _Alloc>
insert(end(), __first, __last); insert(end(), __first, __last);
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_fill_insert(iterator __pos, size_type __n, const value_type& __x) _M_fill_insert(iterator __pos, size_type __n, const value_type& __x)
...@@ -240,7 +236,7 @@ template <typename _Tp, typename _Alloc> ...@@ -240,7 +236,7 @@ template <typename _Tp, typename _Alloc>
_M_insert_aux(__pos, __n, __x); _M_insert_aux(__pos, __n, __x);
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_fill_initialize(const value_type& __value) _M_fill_initialize(const value_type& __value)
...@@ -259,7 +255,7 @@ template <typename _Tp, typename _Alloc> ...@@ -259,7 +255,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
template <typename _InputIterator> template <typename _InputIterator>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
...@@ -279,7 +275,7 @@ template <typename _Tp, typename _Alloc> ...@@ -279,7 +275,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
template <typename _ForwardIterator> template <typename _ForwardIterator>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
...@@ -310,8 +306,8 @@ template <typename _Tp, typename _Alloc> ...@@ -310,8 +306,8 @@ template <typename _Tp, typename _Alloc>
} }
} }
// Called only if _M_finish._M_cur == _M_finish._M_last - 1. // Called only if _M_finish._M_cur == _M_finish._M_last - 1.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_push_back_aux(const value_type& __t) _M_push_back_aux(const value_type& __t)
...@@ -332,9 +328,9 @@ template <typename _Tp, typename _Alloc> ...@@ -332,9 +328,9 @@ template <typename _Tp, typename _Alloc>
} }
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
// Called only if _M_finish._M_cur == _M_finish._M_last - 1. // Called only if _M_finish._M_cur == _M_finish._M_last - 1.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_push_back_aux() _M_push_back_aux()
...@@ -353,10 +349,10 @@ template <typename _Tp, typename _Alloc> ...@@ -353,10 +349,10 @@ template <typename _Tp, typename _Alloc>
__throw_exception_again; __throw_exception_again;
} }
} }
#endif #endif
// Called only if _M_start._M_cur == _M_start._M_first. // Called only if _M_start._M_cur == _M_start._M_first.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_push_front_aux(const value_type& __t) _M_push_front_aux(const value_type& __t)
...@@ -378,9 +374,9 @@ template <typename _Tp, typename _Alloc> ...@@ -378,9 +374,9 @@ template <typename _Tp, typename _Alloc>
} }
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
// Called only if _M_start._M_cur == _M_start._M_first. // Called only if _M_start._M_cur == _M_start._M_first.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_push_front_aux() _M_push_front_aux()
...@@ -400,10 +396,10 @@ template <typename _Tp, typename _Alloc> ...@@ -400,10 +396,10 @@ template <typename _Tp, typename _Alloc>
__throw_exception_again; __throw_exception_again;
} }
} }
#endif #endif
// Called only if _M_finish._M_cur == _M_finish._M_first. // Called only if _M_finish._M_cur == _M_finish._M_first.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void deque<_Tp,_Alloc>:: void deque<_Tp,_Alloc>::
_M_pop_back_aux() _M_pop_back_aux()
{ {
...@@ -413,11 +409,11 @@ template <typename _Tp, typename _Alloc> ...@@ -413,11 +409,11 @@ template <typename _Tp, typename _Alloc>
_Destroy(_M_finish._M_cur); _Destroy(_M_finish._M_cur);
} }
// Called only if _M_start._M_cur == _M_start._M_last - 1. Note that // Called only if _M_start._M_cur == _M_start._M_last - 1. Note that
// if the deque has at least one element (a precondition for this member // if the deque has at least one element (a precondition for this member
// function), and if _M_start._M_cur == _M_start._M_last, then the deque // function), and if _M_start._M_cur == _M_start._M_last, then the deque
// must have at least two nodes. // must have at least two nodes.
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void deque<_Tp,_Alloc>:: void deque<_Tp,_Alloc>::
_M_pop_front_aux() _M_pop_front_aux()
{ {
...@@ -427,7 +423,7 @@ template <typename _Tp, typename _Alloc> ...@@ -427,7 +423,7 @@ template <typename _Tp, typename _Alloc>
_M_start._M_cur = _M_start._M_first; _M_start._M_cur = _M_start._M_first;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
template <typename _InputIterator> template <typename _InputIterator>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
...@@ -438,7 +434,7 @@ template <typename _Tp, typename _Alloc> ...@@ -438,7 +434,7 @@ template <typename _Tp, typename _Alloc>
copy(__first, __last, inserter(*this, __pos)); copy(__first, __last, inserter(*this, __pos));
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
template <typename _ForwardIterator> template <typename _ForwardIterator>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
...@@ -479,7 +475,7 @@ template <typename _Tp, typename _Alloc> ...@@ -479,7 +475,7 @@ template <typename _Tp, typename _Alloc>
_M_insert_aux(__pos, __first, __last, __n); _M_insert_aux(__pos, __first, __last, __n);
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename deque<_Tp, _Alloc>::iterator typename deque<_Tp, _Alloc>::iterator
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_insert_aux(iterator __pos, const value_type& __x) _M_insert_aux(iterator __pos, const value_type& __x)
...@@ -512,12 +508,12 @@ template <typename _Tp, typename _Alloc> ...@@ -512,12 +508,12 @@ template <typename _Tp, typename _Alloc>
return __pos; return __pos;
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
// Nothing seems to actually use this. According to the pattern followed by // Nothing seems to actually use this. According to the pattern followed by
// the rest of the SGI code, it would be called by the deprecated insert(pos) // the rest of the SGI code, it would be called by the deprecated insert(pos)
// function, but that has been replaced. We'll take our time removing this // function, but that has been replaced. We'll take our time removing this
// anyhow; mark for 3.4. -pme // anyhow; mark for 3.4. -pme
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename deque<_Tp,_Alloc>::iterator typename deque<_Tp,_Alloc>::iterator
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_insert_aux(iterator __pos) _M_insert_aux(iterator __pos)
...@@ -548,9 +544,9 @@ template <typename _Tp, typename _Alloc> ...@@ -548,9 +544,9 @@ template <typename _Tp, typename _Alloc>
*__pos = value_type(); *__pos = value_type();
return __pos; return __pos;
} }
#endif #endif
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_insert_aux(iterator __pos, size_type __n, const value_type& __x) _M_insert_aux(iterator __pos, size_type __n, const value_type& __x)
...@@ -620,7 +616,7 @@ template <typename _Tp, typename _Alloc> ...@@ -620,7 +616,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
template <typename _ForwardIterator> template <typename _ForwardIterator>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
...@@ -696,7 +692,7 @@ template <typename _Tp, typename _Alloc> ...@@ -696,7 +692,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_new_elements_at_front(size_type __new_elems) _M_new_elements_at_front(size_type __new_elems)
...@@ -718,7 +714,7 @@ template <typename _Tp, typename _Alloc> ...@@ -718,7 +714,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_new_elements_at_back(size_type __new_elems) _M_new_elements_at_back(size_type __new_elems)
...@@ -740,7 +736,7 @@ template <typename _Tp, typename _Alloc> ...@@ -740,7 +736,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
deque<_Tp,_Alloc>:: deque<_Tp,_Alloc>::
_M_reallocate_map(size_type __nodes_to_add, bool __add_at_front) _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)
...@@ -777,7 +773,6 @@ template <typename _Tp, typename _Alloc> ...@@ -777,7 +773,6 @@ template <typename _Tp, typename _Alloc>
_M_start._M_set_node(__new_nstart); _M_start._M_set_node(__new_nstart);
_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); _M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
} }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_DEQUE_TCC */ #endif /* __GLIBCPP_INTERNAL_DEQUE_TCC */
......
...@@ -61,13 +61,9 @@ ...@@ -61,13 +61,9 @@
#ifndef __GLIBCPP_INTERNAL_LIST_TCC #ifndef __GLIBCPP_INTERNAL_LIST_TCC
#define __GLIBCPP_INTERNAL_LIST_TCC #define __GLIBCPP_INTERNAL_LIST_TCC
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
template<typename _Tp, typename _Alloc>
template<typename _Tp, typename _Alloc>
void void
_List_base<_Tp,_Alloc>:: _List_base<_Tp,_Alloc>::
__clear() __clear()
...@@ -85,7 +81,7 @@ template<typename _Tp, typename _Alloc> ...@@ -85,7 +81,7 @@ template<typename _Tp, typename _Alloc>
_M_node->_M_prev = _M_node; _M_node->_M_prev = _M_node;
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
typename list<_Tp,_Alloc>::iterator typename list<_Tp,_Alloc>::iterator
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
...@@ -98,7 +94,7 @@ template<typename _Tp, typename _Alloc> ...@@ -98,7 +94,7 @@ template<typename _Tp, typename _Alloc>
return __tmp; return __tmp;
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
typename list<_Tp,_Alloc>::iterator typename list<_Tp,_Alloc>::iterator
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
erase(iterator __position) erase(iterator __position)
...@@ -113,7 +109,7 @@ template<typename _Tp, typename _Alloc> ...@@ -113,7 +109,7 @@ template<typename _Tp, typename _Alloc>
return iterator(static_cast<_Node*>(__next_node)); return iterator(static_cast<_Node*>(__next_node));
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
resize(size_type __new_size, const value_type& __x) resize(size_type __new_size, const value_type& __x)
...@@ -128,7 +124,7 @@ template<typename _Tp, typename _Alloc> ...@@ -128,7 +124,7 @@ template<typename _Tp, typename _Alloc>
insert(end(), __new_size - __len, __x); insert(end(), __new_size - __len, __x);
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
list<_Tp,_Alloc>& list<_Tp,_Alloc>&
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
operator=(const list& __x) operator=(const list& __x)
...@@ -149,7 +145,7 @@ template<typename _Tp, typename _Alloc> ...@@ -149,7 +145,7 @@ template<typename _Tp, typename _Alloc>
return *this; return *this;
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
_M_fill_assign(size_type __n, const value_type& __val) _M_fill_assign(size_type __n, const value_type& __val)
...@@ -163,7 +159,7 @@ template<typename _Tp, typename _Alloc> ...@@ -163,7 +159,7 @@ template<typename _Tp, typename _Alloc>
erase(__i, end()); erase(__i, end());
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _InputIter> template <typename _InputIter>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
...@@ -179,7 +175,7 @@ template<typename _Tp, typename _Alloc> ...@@ -179,7 +175,7 @@ template<typename _Tp, typename _Alloc>
insert(__last1, __first2, __last2); insert(__last1, __first2, __last2);
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
remove(const value_type& __value) remove(const value_type& __value)
...@@ -196,7 +192,7 @@ template<typename _Tp, typename _Alloc> ...@@ -196,7 +192,7 @@ template<typename _Tp, typename _Alloc>
} }
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
unique() unique()
...@@ -215,7 +211,7 @@ template<typename _Tp, typename _Alloc> ...@@ -215,7 +211,7 @@ template<typename _Tp, typename _Alloc>
} }
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
merge(list& __x) merge(list& __x)
...@@ -237,18 +233,18 @@ template<typename _Tp, typename _Alloc> ...@@ -237,18 +233,18 @@ template<typename _Tp, typename _Alloc>
_M_transfer(__last1, __first2, __last2); _M_transfer(__last1, __first2, __last2);
} }
// FIXME put this somewhere else // FIXME put this somewhere else
inline void inline void
__List_base_reverse(_List_node_base* __p) __List_base_reverse(_List_node_base* __p)
{ {
_List_node_base* __tmp = __p; _List_node_base* __tmp = __p;
do { do {
std::swap(__tmp->_M_next, __tmp->_M_prev); std::swap(__tmp->_M_next, __tmp->_M_prev);
__tmp = __tmp->_M_prev; // Old next node is now prev. __tmp = __tmp->_M_prev; // Old next node is now prev.
} while (__tmp != __p); } while (__tmp != __p);
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
sort() sort()
...@@ -278,7 +274,7 @@ template<typename _Tp, typename _Alloc> ...@@ -278,7 +274,7 @@ template<typename _Tp, typename _Alloc>
} }
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _Predicate> template <typename _Predicate>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
...@@ -295,7 +291,7 @@ template<typename _Tp, typename _Alloc> ...@@ -295,7 +291,7 @@ template<typename _Tp, typename _Alloc>
} }
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _BinaryPredicate> template <typename _BinaryPredicate>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
...@@ -315,7 +311,7 @@ template<typename _Tp, typename _Alloc> ...@@ -315,7 +311,7 @@ template<typename _Tp, typename _Alloc>
} }
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _StrictWeakOrdering> template <typename _StrictWeakOrdering>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
...@@ -337,7 +333,7 @@ template<typename _Tp, typename _Alloc> ...@@ -337,7 +333,7 @@ template<typename _Tp, typename _Alloc>
if (__first2 != __last2) _M_transfer(__last1, __first2, __last2); if (__first2 != __last2) _M_transfer(__last1, __first2, __last2);
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template <typename _StrictWeakOrdering> template <typename _StrictWeakOrdering>
void void
list<_Tp,_Alloc>:: list<_Tp,_Alloc>::
...@@ -367,8 +363,6 @@ template<typename _Tp, typename _Alloc> ...@@ -367,8 +363,6 @@ template<typename _Tp, typename _Alloc>
swap(__counter[__fill-1]); swap(__counter[__fill-1]);
} }
} }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_LIST_TCC */ #endif /* __GLIBCPP_INTERNAL_LIST_TCC */
...@@ -65,13 +65,9 @@ ...@@ -65,13 +65,9 @@
#include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h> #include <bits/stl_iterator_base_funcs.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
/**
/**
* @if maint * @if maint
* @brief This function controls the size of memory nodes. * @brief This function controls the size of memory nodes.
* @param size The size of an element. * @param size The size of an element.
...@@ -82,13 +78,13 @@ namespace std ...@@ -82,13 +78,13 @@ namespace std
* tuneable (and no other code needs to change), but no investigation has * tuneable (and no other code needs to change), but no investigation has
* been done since inheriting the SGI code. * been done since inheriting the SGI code.
* @endif * @endif
*/ */
inline size_t inline size_t
__deque_buf_size(size_t __size) __deque_buf_size(size_t __size)
{ return __size < 512 ? size_t(512 / __size) : size_t(1); } { return __size < 512 ? size_t(512 / __size) : size_t(1); }
/** /**
* @brief A deque::iterator. * @brief A deque::iterator.
* *
* Quite a bit of intelligence here. Much of the functionality of deque is * Quite a bit of intelligence here. Much of the functionality of deque is
...@@ -99,10 +95,10 @@ __deque_buf_size(size_t __size) ...@@ -99,10 +95,10 @@ __deque_buf_size(size_t __size)
* @if maint * @if maint
* All the functions are op overloads except for _M_set_node. * All the functions are op overloads except for _M_set_node.
* @endif * @endif
*/ */
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
struct _Deque_iterator struct _Deque_iterator
{ {
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); }
...@@ -204,141 +200,141 @@ template <typename _Tp, typename _Ref, typename _Ptr> ...@@ -204,141 +200,141 @@ template <typename _Tp, typename _Ref, typename _Ptr>
_M_first = *__new_node; _M_first = *__new_node;
_M_last = _M_first + difference_type(_S_buffer_size()); _M_last = _M_first + difference_type(_S_buffer_size());
} }
}; };
// Note: we also provide overloads whose operands are of the same type in // Note: we also provide overloads whose operands are of the same type in
// order to avoid ambiguous overload resolution when std::rel_ops operators // order to avoid ambiguous overload resolution when std::rel_ops operators
// are in scope (for additional details, see libstdc++/3628) // are in scope (for additional details, see libstdc++/3628)
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return __x._M_cur == __y._M_cur; return __x._M_cur == __y._M_cur;
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return __x._M_cur == __y._M_cur; return __x._M_cur == __y._M_cur;
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return !(__x == __y); return !(__x == __y);
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return !(__x == __y); return !(__x == __y);
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return (__x._M_node == __y._M_node) ? return (__x._M_node == __y._M_node) ?
(__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return (__x._M_node == __y._M_node) ? return (__x._M_node == __y._M_node) ?
(__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return __y < __x; return __y < __x;
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return __y < __x; return __y < __x;
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return !(__y < __x); return !(__y < __x);
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return !(__y < __x); return !(__y < __x);
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline bool inline bool
operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
{ {
return !(__x < __y); return !(__x < __y);
} }
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline bool inline bool
operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return !(__x < __y); return !(__x < __y);
} }
// _GLIBCPP_RESOLVE_LIB_DEFECTS // _GLIBCPP_RESOLVE_LIB_DEFECTS
// According to the resolution of DR179 not only the various comparison // According to the resolution of DR179 not only the various comparison
// operators but also operator- must accept mixed iterator/const_iterator // operators but also operator- must accept mixed iterator/const_iterator
// parameters. // parameters.
template <typename _Tp, typename _RefL, typename _PtrL, template <typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR> typename _RefR, typename _PtrR>
inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
{ {
return _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type return _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
(_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) * (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) *
(__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) + (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) +
(__y._M_last - __y._M_cur); (__y._M_last - __y._M_cur);
} }
template <typename _Tp, typename _Ref, typename _Ptr> template <typename _Tp, typename _Ref, typename _Ptr>
inline _Deque_iterator<_Tp, _Ref, _Ptr> inline _Deque_iterator<_Tp, _Ref, _Ptr>
operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
{ {
return __x + __n; return __x + __n;
} }
/// @if maint Primary default version. @endif /// @if maint Primary default version. @endif
/** /**
* @if maint * @if maint
* Deque base class. It has two purposes. First, its constructor * Deque base class. It has two purposes. First, its constructor
* and destructor allocate (but don't initialize) storage. This makes * and destructor allocate (but don't initialize) storage. This makes
...@@ -348,11 +344,11 @@ operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) ...@@ -348,11 +344,11 @@ operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
* versions: this ordinary one, and the space-saving specialization for * versions: this ordinary one, and the space-saving specialization for
* instanceless allocators. * instanceless allocators.
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc, bool __is_static> template <typename _Tp, typename _Alloc, bool __is_static>
class _Deque_alloc_base class _Deque_alloc_base
{ {
public: public:
typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; } allocator_type get_allocator() const { return _M_node_allocator; }
...@@ -361,7 +357,7 @@ public: ...@@ -361,7 +357,7 @@ public:
_M_map(0), _M_map_size(0) _M_map(0), _M_map_size(0)
{} {}
protected: protected:
typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type
_Map_allocator_type; _Map_allocator_type;
...@@ -389,13 +385,13 @@ protected: ...@@ -389,13 +385,13 @@ protected:
_Map_allocator_type _M_map_allocator; _Map_allocator_type _M_map_allocator;
_Tp** _M_map; _Tp** _M_map;
size_t _M_map_size; size_t _M_map_size;
}; };
/// @if maint Specialization for instanceless allocators. @endif /// @if maint Specialization for instanceless allocators. @endif
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
class _Deque_alloc_base<_Tp, _Alloc, true> class _Deque_alloc_base<_Tp, _Alloc, true>
{ {
public: public:
typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
allocator_type get_allocator() const { return allocator_type(); } allocator_type get_allocator() const { return allocator_type(); }
...@@ -403,7 +399,7 @@ public: ...@@ -403,7 +399,7 @@ public:
: _M_map(0), _M_map_size(0) : _M_map(0), _M_map_size(0)
{} {}
protected: protected:
typedef typename _Alloc_traits<_Tp,_Alloc>::_Alloc_type _Node_alloc_type; typedef typename _Alloc_traits<_Tp,_Alloc>::_Alloc_type _Node_alloc_type;
typedef typename _Alloc_traits<_Tp*,_Alloc>::_Alloc_type _Map_alloc_type; typedef typename _Alloc_traits<_Tp*,_Alloc>::_Alloc_type _Map_alloc_type;
...@@ -429,25 +425,26 @@ protected: ...@@ -429,25 +425,26 @@ protected:
_Tp** _M_map; _Tp** _M_map;
size_t _M_map_size; size_t _M_map_size;
}; };
/** /**
* @if maint * @if maint
* Deque base class. Using _Alloc_traits in the instantiation of the parent * Deque base class. Using _Alloc_traits in the instantiation of the parent
* class provides the compile-time dispatching mentioned in the parent's docs. * class provides the compile-time dispatching mentioned in the parent's
* This class provides the unified face for %deque's allocation. * docs. This class provides the unified face for %deque's allocation.
* *
* Nothing in this class ever constructs or destroys an actual Tp element. * Nothing in this class ever constructs or destroys an actual Tp element.
* (Deque handles that itself.) Only/All memory management is performed here. * (Deque handles that itself.) Only/All memory management is performed
* here.
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
class _Deque_base class _Deque_base
: public _Deque_alloc_base<_Tp,_Alloc, : public _Deque_alloc_base<_Tp,_Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{ {
public: public:
typedef _Deque_alloc_base<_Tp,_Alloc, typedef _Deque_alloc_base<_Tp,_Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base; _Base;
...@@ -462,7 +459,7 @@ public: ...@@ -462,7 +459,7 @@ public:
: _Base(__a), _M_start(), _M_finish() {} : _Base(__a), _M_start(), _M_finish() {}
~_Deque_base(); ~_Deque_base();
protected: protected:
void _M_initialize_map(size_t); void _M_initialize_map(size_t);
void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
...@@ -470,32 +467,33 @@ protected: ...@@ -470,32 +467,33 @@ protected:
iterator _M_start; iterator _M_start;
iterator _M_finish; iterator _M_finish;
}; };
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
_Deque_base<_Tp,_Alloc>::~_Deque_base() _Deque_base<_Tp,_Alloc>::~_Deque_base()
{ {
if (_M_map) if (_M_map)
{ {
_M_destroy_nodes(_M_start._M_node, _M_finish._M_node + 1); _M_destroy_nodes(_M_start._M_node, _M_finish._M_node + 1);
_M_deallocate_map(_M_map, _M_map_size); _M_deallocate_map(_M_map, _M_map_size);
} }
} }
/** /**
* @if maint * @if maint
* @brief Layout storage. * @brief Layout storage.
* @param num_elements The count of T's for which to allocate space at first. * @param num_elements The count of T's for which to allocate space
* at first.
* @return Nothing. * @return Nothing.
* *
* The initial underlying memory layout is a bit complicated... * The initial underlying memory layout is a bit complicated...
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
_Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements)
{ {
size_t __num_nodes = size_t __num_nodes =
__num_elements / __deque_buf_size(sizeof(_Tp)) + 1; __num_elements / __deque_buf_size(sizeof(_Tp)) + 1;
...@@ -524,11 +522,11 @@ _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) ...@@ -524,11 +522,11 @@ _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements)
_M_start._M_cur = _M_start._M_first; _M_start._M_cur = _M_start._M_first;
_M_finish._M_cur = _M_finish._M_first + _M_finish._M_cur = _M_finish._M_first +
__num_elements % __deque_buf_size(sizeof(_Tp)); __num_elements % __deque_buf_size(sizeof(_Tp));
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish) void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish)
{ {
_Tp** __cur; _Tp** __cur;
try try
{ {
...@@ -540,18 +538,18 @@ void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish) ...@@ -540,18 +538,18 @@ void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish)
_M_destroy_nodes(__nstart, __cur); _M_destroy_nodes(__nstart, __cur);
__throw_exception_again; __throw_exception_again;
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
_Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
{ {
for (_Tp** __n = __nstart; __n < __nfinish; ++__n) for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
_M_deallocate_node(*__n); _M_deallocate_node(*__n);
} }
/** /**
* @brief A standard container using fixed-size memory allocation and * @brief A standard container using fixed-size memory allocation and
* constant-time manipulation of elements at either end. * constant-time manipulation of elements at either end.
* *
...@@ -563,10 +561,10 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) ...@@ -563,10 +561,10 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
* <a href="tables.html#67">sequence</a>, including the * <a href="tables.html#67">sequence</a>, including the
* <a href="tables.html#68">optional sequence requirements</a>. * <a href="tables.html#68">optional sequence requirements</a>.
* *
* In previous HP/SGI versions of deque, there was an extra template parameter * In previous HP/SGI versions of deque, there was an extra template
* so users could control the node size. This extension turned out to violate * parameter so users could control the node size. This extension turned
* the C++ standard (it can be detected using template template parameters), * out to violate the C++ standard (it can be detected using template
* and it was removed. * template parameters), and it was removed.
* *
* @if maint * @if maint
* Here's how a deque<Tp> manages memory. Each deque has 4 members: * Here's how a deque<Tp> manages memory. Each deque has 4 members:
...@@ -612,8 +610,8 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) ...@@ -612,8 +610,8 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
* an empty deque must have one node, a deque with <N elements (where N is * an empty deque must have one node, a deque with <N elements (where N is
* the node buffer size) must have one node, a deque with N through (2N-1) * the node buffer size) must have one node, a deque with N through (2N-1)
* elements must have two nodes, etc. * elements must have two nodes, etc.
* - For every node other than start.node and finish.node, every element in the * - For every node other than start.node and finish.node, every element in
* node is an initialized object. If start.node == finish.node, then * the node is an initialized object. If start.node == finish.node, then
* [start.cur, finish.cur) are initialized objects, and the elements outside * [start.cur, finish.cur) are initialized objects, and the elements outside
* that range are uninitialized storage. Otherwise, [start.cur, start.last) * that range are uninitialized storage. Otherwise, [start.cur, start.last)
* and [finish.first, finish.cur) are initialized objects, and [start.first, * and [finish.first, finish.cur) are initialized objects, and [start.first,
...@@ -621,27 +619,29 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) ...@@ -621,27 +619,29 @@ _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
* - [%map, %map + map_size) is a valid, non-empty range. * - [%map, %map + map_size) is a valid, non-empty range.
* - [start.node, finish.node] is a valid range contained within * - [start.node, finish.node] is a valid range contained within
* [%map, %map + map_size). * [%map, %map + map_size).
* - A pointer in the range [%map, %map + map_size) points to an allocated node * - A pointer in the range [%map, %map + map_size) points to an allocated
* if and only if the pointer is in the range [start.node, finish.node]. * node if and only if the pointer is in the range
* [start.node, finish.node].
* *
* Here's the magic: nothing in deque is "aware" of the discontiguous storage! * Here's the magic: nothing in deque is "aware" of the discontiguous
* storage!
* *
* The memory setup and layout occurs in the parent, _Base, and the iterator * The memory setup and layout occurs in the parent, _Base, and the iterator
* class is entirely responsible for "leaping" from one node to the next. All * class is entirely responsible for "leaping" from one node to the next.
* the implementation routines for deque itself work only through the start * All the implementation routines for deque itself work only through the
* and finish iterators. This keeps the routines simple and sane, and we can * start and finish iterators. This keeps the routines simple and sane,
* use other standard algorithms as well. * and we can use other standard algorithms as well.
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc = allocator<_Tp> > template <typename _Tp, typename _Alloc = allocator<_Tp> >
class deque : protected _Deque_base<_Tp, _Alloc> class deque : protected _Deque_base<_Tp, _Alloc>
{ {
// concept requirements // concept requirements
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
typedef _Deque_base<_Tp, _Alloc> _Base; typedef _Deque_base<_Tp, _Alloc> _Base;
public: public:
typedef _Tp value_type; typedef _Tp value_type;
typedef value_type* pointer; typedef value_type* pointer;
typedef const value_type* const_pointer; typedef const value_type* const_pointer;
...@@ -655,7 +655,7 @@ public: ...@@ -655,7 +655,7 @@ public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
protected: protected:
typedef pointer* _Map_pointer; typedef pointer* _Map_pointer;
static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); }
...@@ -679,7 +679,7 @@ protected: ...@@ -679,7 +679,7 @@ protected:
using _Base::_M_start; using _Base::_M_start;
using _Base::_M_finish; using _Base::_M_finish;
public: public:
// [23.2.1.1] construct/copy/destroy // [23.2.1.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section) // (assign() and get_allocator() are also listed in this section)
/** /**
...@@ -758,8 +758,8 @@ public: ...@@ -758,8 +758,8 @@ public:
* @brief %Deque assignment operator. * @brief %Deque assignment operator.
* @param x A %deque of identical element and allocator types. * @param x A %deque of identical element and allocator types.
* *
* All the elements of @a x are copied, but unlike the copy constructor, the * All the elements of @a x are copied, but unlike the copy constructor,
* allocator object is not copied. * the allocator object is not copied.
*/ */
deque& deque&
operator=(const deque& __x); operator=(const deque& __x);
...@@ -931,7 +931,7 @@ public: ...@@ -931,7 +931,7 @@ public:
const_reference const_reference
operator[](size_type __n) const { return _M_start[difference_type(__n)]; } operator[](size_type __n) const { return _M_start[difference_type(__n)]; }
protected: protected:
/// @if maint Safety check used only from at(). @endif /// @if maint Safety check used only from at(). @endif
void void
_M_range_check(size_type __n) const _M_range_check(size_type __n) const
...@@ -940,7 +940,7 @@ protected: ...@@ -940,7 +940,7 @@ protected:
__throw_out_of_range("deque [] access out of range"); __throw_out_of_range("deque [] access out of range");
} }
public: public:
/** /**
* @brief Provides access to the data contained in the %deque. * @brief Provides access to the data contained in the %deque.
* @param n The index of the element for which data should be accessed. * @param n The index of the element for which data should be accessed.
...@@ -1025,14 +1025,14 @@ public: ...@@ -1025,14 +1025,14 @@ public:
_M_push_front_aux(__x); _M_push_front_aux(__x);
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Add data to the front of the %deque. * @brief Add data to the front of the %deque.
* *
* This is a typical stack operation. The function creates a * This is a typical stack operation. The function creates a
* default-constructed element at the front of the %deque. Due to the nature * default-constructed element at the front of the %deque. Due to the
* of a %deque this operation can be done in constant time. You should * nature of a %deque this operation can be done in constant time. You
* consider using push_front(value_type()) instead. * should consider using push_front(value_type()) instead.
* *
* @note This was deprecated in 3.2 and will be removed in 3.4. You must * @note This was deprecated in 3.2 and will be removed in 3.4. You must
* define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see * define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
...@@ -1048,7 +1048,7 @@ public: ...@@ -1048,7 +1048,7 @@ public:
else else
_M_push_front_aux(); _M_push_front_aux();
} }
#endif #endif
/** /**
* @brief Add data to the end of the %deque. * @brief Add data to the end of the %deque.
...@@ -1069,7 +1069,7 @@ public: ...@@ -1069,7 +1069,7 @@ public:
_M_push_back_aux(__x); _M_push_back_aux(__x);
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Add data to the end of the %deque. * @brief Add data to the end of the %deque.
* *
...@@ -1092,7 +1092,7 @@ public: ...@@ -1092,7 +1092,7 @@ public:
else else
_M_push_back_aux(); _M_push_back_aux();
} }
#endif #endif
/** /**
* @brief Removes first element. * @brief Removes first element.
...@@ -1144,7 +1144,7 @@ public: ...@@ -1144,7 +1144,7 @@ public:
iterator iterator
insert(iterator position, const value_type& __x); insert(iterator position, const value_type& __x);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Inserts an element into the %deque. * @brief Inserts an element into the %deque.
* @param position An iterator into the %deque. * @param position An iterator into the %deque.
...@@ -1161,7 +1161,7 @@ public: ...@@ -1161,7 +1161,7 @@ public:
iterator iterator
insert(iterator __position) insert(iterator __position)
{ return insert(__position, value_type()); } { return insert(__position, value_type()); }
#endif #endif
/** /**
* @brief Inserts a number of copies of given data into the %deque. * @brief Inserts a number of copies of given data into the %deque.
...@@ -1214,7 +1214,8 @@ public: ...@@ -1214,7 +1214,8 @@ public:
/** /**
* @brief Remove a range of elements. * @brief Remove a range of elements.
* @param first Iterator pointing to the first element to be erased. * @param first Iterator pointing to the first element to be erased.
* @param last Iterator pointing to one past the last element to be erased. * @param last Iterator pointing to one past the last element to be
* erased.
* @return An iterator pointing to the element pointed to by @a last * @return An iterator pointing to the element pointed to by @a last
* prior to erasing (or end()). * prior to erasing (or end()).
* *
...@@ -1255,7 +1256,7 @@ public: ...@@ -1255,7 +1256,7 @@ public:
*/ */
void clear(); void clear();
protected: protected:
// Internal constructor functions follow. // Internal constructor functions follow.
// called by the range constructor to implement [23.1.1]/9 // called by the range constructor to implement [23.1.1]/9
...@@ -1270,7 +1271,8 @@ protected: ...@@ -1270,7 +1271,8 @@ protected:
// called by the range constructor to implement [23.1.1]/9 // called by the range constructor to implement [23.1.1]/9
template<typename _InputIter> template<typename _InputIter>
void void
_M_initialize_dispatch(_InputIter __first, _InputIter __last, __false_type) _M_initialize_dispatch(_InputIter __first, _InputIter __last,
__false_type)
{ {
typedef typename iterator_traits<_InputIter>::iterator_category typedef typename iterator_traits<_InputIter>::iterator_category
_IterCategory; _IterCategory;
...@@ -1388,10 +1390,10 @@ protected: ...@@ -1388,10 +1390,10 @@ protected:
*/ */
void _M_push_back_aux(const value_type&); void _M_push_back_aux(const value_type&);
void _M_push_front_aux(const value_type&); void _M_push_front_aux(const value_type&);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
void _M_push_back_aux(); void _M_push_back_aux();
void _M_push_front_aux(); void _M_push_front_aux();
#endif #endif
void _M_pop_back_aux(); void _M_pop_back_aux();
void _M_pop_front_aux(); void _M_pop_front_aux();
/** @} */ /** @} */
...@@ -1403,7 +1405,8 @@ protected: ...@@ -1403,7 +1405,8 @@ protected:
// called by the range insert to implement [23.1.1]/9 // called by the range insert to implement [23.1.1]/9
template<typename _Integer> template<typename _Integer>
void void
_M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, __true_type) _M_insert_dispatch(iterator __pos,
_Integer __n, _Integer __x, __true_type)
{ {
_M_fill_insert(__pos, static_cast<size_type>(__n), _M_fill_insert(__pos, static_cast<size_type>(__n),
static_cast<value_type>(__x)); static_cast<value_type>(__x));
...@@ -1454,14 +1457,15 @@ protected: ...@@ -1454,14 +1457,15 @@ protected:
_ForwardIterator __first, _ForwardIterator __last, _ForwardIterator __first, _ForwardIterator __last,
size_type __n); size_type __n);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
// unused, see comment in implementation // unused, see comment in implementation
iterator _M_insert_aux(iterator __pos); iterator _M_insert_aux(iterator __pos);
#endif #endif
/** @{ /** @{
* @if maint * @if maint
* @brief Memory-handling helpers for the previous internal insert functions. * @brief Memory-handling helpers for the previous internal insert
* functions.
* @endif * @endif
*/ */
iterator iterator
...@@ -1516,10 +1520,10 @@ protected: ...@@ -1516,10 +1520,10 @@ protected:
void void
_M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
/** @} */ /** @} */
}; };
/** /**
* @brief Deque equality comparison. * @brief Deque equality comparison.
* @param x A %deque. * @param x A %deque.
* @param y A %deque of the same type as @a x. * @param y A %deque of the same type as @a x.
...@@ -1528,16 +1532,16 @@ protected: ...@@ -1528,16 +1532,16 @@ protected:
* This is an equivalence relation. It is linear in the size of the * This is an equivalence relation. It is linear in the size of the
* deques. Deques are considered equivalent if their sizes are equal, * deques. Deques are considered equivalent if their sizes are equal,
* and if corresponding elements compare equal. * and if corresponding elements compare equal.
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool operator==(const deque<_Tp, _Alloc>& __x, inline bool operator==(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) const deque<_Tp, _Alloc>& __y)
{ {
return __x.size() == __y.size() && return __x.size() == __y.size() &&
equal(__x.begin(), __x.end(), __y.begin()); equal(__x.begin(), __x.end(), __y.begin());
} }
/** /**
* @brief Deque ordering relation. * @brief Deque ordering relation.
* @param x A %deque. * @param x A %deque.
* @param y A %deque of the same type as @a x. * @param y A %deque of the same type as @a x.
...@@ -1547,51 +1551,49 @@ inline bool operator==(const deque<_Tp, _Alloc>& __x, ...@@ -1547,51 +1551,49 @@ inline bool operator==(const deque<_Tp, _Alloc>& __x,
* deques. The elements must be comparable with @c <. * deques. The elements must be comparable with @c <.
* *
* See std::lexographical_compare() for how the determination is made. * See std::lexographical_compare() for how the determination is made.
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool operator<(const deque<_Tp, _Alloc>& __x, inline bool operator<(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) const deque<_Tp, _Alloc>& __y)
{ {
return lexicographical_compare(__x.begin(), __x.end(), return 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>
inline bool operator!=(const deque<_Tp, _Alloc>& __x, inline bool operator!=(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) { const deque<_Tp, _Alloc>& __y) {
return !(__x == __y); return !(__x == __y);
} }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool operator>(const deque<_Tp, _Alloc>& __x, inline bool operator>(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) { const deque<_Tp, _Alloc>& __y) {
return __y < __x; return __y < __x;
} }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool operator<=(const deque<_Tp, _Alloc>& __x, inline bool operator<=(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) { const deque<_Tp, _Alloc>& __y) {
return !(__y < __x); return !(__y < __x);
} }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool operator>=(const deque<_Tp, _Alloc>& __x, inline bool operator>=(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y) { const deque<_Tp, _Alloc>& __y) {
return !(__x < __y); return !(__x < __y);
} }
/// See std::deque::swap(). /// See std::deque::swap().
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline void swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) inline void swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
{ {
__x.swap(__y); __x.swap(__y);
} }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_DEQUE_H */ #endif /* __GLIBCPP_INTERNAL_DEQUE_H */
...@@ -67,14 +67,12 @@ ...@@ -67,14 +67,12 @@
#pragma GCC system_header #pragma GCC system_header
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
template<typename _InputIterator> template<typename _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) __distance(_InputIterator __first, _InputIterator __last,
input_iterator_tag)
{ {
// concept requirements // concept requirements
__glibcpp_function_requires(_InputIteratorConcept<_InputIterator>) __glibcpp_function_requires(_InputIteratorConcept<_InputIterator>)
...@@ -86,7 +84,7 @@ template<typename _InputIterator> ...@@ -86,7 +84,7 @@ template<typename _InputIterator>
return __n; return __n;
} }
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
inline typename iterator_traits<_RandomAccessIterator>::difference_type inline typename iterator_traits<_RandomAccessIterator>::difference_type
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last, __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
random_access_iterator_tag) random_access_iterator_tag)
...@@ -96,7 +94,7 @@ template<typename _RandomAccessIterator> ...@@ -96,7 +94,7 @@ template<typename _RandomAccessIterator>
return __last - __first; return __last - __first;
} }
/** /**
* @brief A generalization of pointer arithmetic. * @brief A generalization of pointer arithmetic.
* @param first An input iterator. * @param first An input iterator.
* @param last An input iterator. * @param last An input iterator.
...@@ -107,8 +105,8 @@ template<typename _RandomAccessIterator> ...@@ -107,8 +105,8 @@ template<typename _RandomAccessIterator>
* *
* For random access iterators, this uses their @c + and @c - operations * For random access iterators, this uses their @c + and @c - operations
* and are constant time. For other %iterator classes they are linear time. * and are constant time. For other %iterator classes they are linear time.
*/ */
template<typename _InputIterator> template<typename _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last) distance(_InputIterator __first, _InputIterator __last)
{ {
...@@ -116,7 +114,7 @@ template<typename _InputIterator> ...@@ -116,7 +114,7 @@ template<typename _InputIterator>
return __distance(__first, __last, __iterator_category(__first)); return __distance(__first, __last, __iterator_category(__first));
} }
template<typename _InputIter, typename _Distance> template<typename _InputIter, typename _Distance>
inline void inline void
__advance(_InputIter& __i, _Distance __n, input_iterator_tag) __advance(_InputIter& __i, _Distance __n, input_iterator_tag)
{ {
...@@ -125,7 +123,7 @@ template<typename _InputIter, typename _Distance> ...@@ -125,7 +123,7 @@ template<typename _InputIter, typename _Distance>
while (__n--) ++__i; while (__n--) ++__i;
} }
template<typename _BidirectionalIterator, typename _Distance> template<typename _BidirectionalIterator, typename _Distance>
inline void inline void
__advance(_BidirectionalIterator& __i, _Distance __n, __advance(_BidirectionalIterator& __i, _Distance __n,
bidirectional_iterator_tag) bidirectional_iterator_tag)
...@@ -139,7 +137,7 @@ template<typename _BidirectionalIterator, typename _Distance> ...@@ -139,7 +137,7 @@ template<typename _BidirectionalIterator, typename _Distance>
while (__n++) --__i; while (__n++) --__i;
} }
template<typename _RandomAccessIterator, typename _Distance> template<typename _RandomAccessIterator, typename _Distance>
inline void inline void
__advance(_RandomAccessIterator& __i, _Distance __n, __advance(_RandomAccessIterator& __i, _Distance __n,
random_access_iterator_tag) random_access_iterator_tag)
...@@ -149,7 +147,7 @@ template<typename _RandomAccessIterator, typename _Distance> ...@@ -149,7 +147,7 @@ template<typename _RandomAccessIterator, typename _Distance>
__i += __n; __i += __n;
} }
/** /**
* @brief A generalization of pointer arithmetic. * @brief A generalization of pointer arithmetic.
* @param i An input iterator. * @param i An input iterator.
* @param n The "delta" by which to change @p i. * @param n The "delta" by which to change @p i.
...@@ -160,20 +158,14 @@ template<typename _RandomAccessIterator, typename _Distance> ...@@ -160,20 +158,14 @@ template<typename _RandomAccessIterator, typename _Distance>
* *
* For random access iterators, this uses their @c + and @c - operations * For random access iterators, this uses their @c + and @c - operations
* and are constant time. For other %iterator classes they are linear time. * and are constant time. For other %iterator classes they are linear time.
*/ */
template<typename _InputIterator, typename _Distance> template<typename _InputIterator, typename _Distance>
inline void inline void
advance(_InputIterator& __i, _Distance __n) advance(_InputIterator& __i, _Distance __n)
{ {
// concept requirements -- taken care of in __advance // concept requirements -- taken care of in __advance
__advance(__i, __n, __iterator_category(__i)); __advance(__i, __n, __iterator_category(__i));
} }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_ITERATOR_BASE_FUNCS_H */ #endif /* __GLIBCPP_INTERNAL_ITERATOR_BASE_FUNCS_H */
// Local Variables:
// mode:C++
// End:
...@@ -63,33 +63,29 @@ ...@@ -63,33 +63,29 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
// Supporting structures are split into common and templated types; the
// latter publicly inherits from the former in an effort to reduce code
// duplication. This results in some "needless" static_cast'ing later on,
// but it's all safe downcasting.
// Supporting structures are split into common and templated types; the /// @if maint Common part of a node in the %list. @endif
// latter publicly inherits from the former in an effort to reduce code struct _List_node_base
// duplication. This results in some "needless" static_cast'ing later on, {
// but it's all safe downcasting.
/// @if maint Common part of a node in the %list. @endif
struct _List_node_base
{
_List_node_base* _M_next; ///< Self-explanatory _List_node_base* _M_next; ///< Self-explanatory
_List_node_base* _M_prev; ///< Self-explanatory _List_node_base* _M_prev; ///< Self-explanatory
}; };
/// @if maint An actual node in the %list. @endif /// @if maint An actual node in the %list. @endif
template<typename _Tp> template<typename _Tp>
struct _List_node : public _List_node_base struct _List_node : public _List_node_base
{ {
_Tp _M_data; ///< User's data. _Tp _M_data; ///< User's data.
}; };
/** /**
* @if maint * @if maint
* @brief Common part of a list::iterator. * @brief Common part of a list::iterator.
* *
...@@ -97,9 +93,9 @@ template<typename _Tp> ...@@ -97,9 +93,9 @@ template<typename _Tp>
* be self-explanatory after taking any decent introductory data structures * be self-explanatory after taking any decent introductory data structures
* course. * course.
* @endif * @endif
*/ */
struct _List_iterator_base struct _List_iterator_base
{ {
typedef size_t size_type; typedef size_t size_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef bidirectional_iterator_tag iterator_category; typedef bidirectional_iterator_tag iterator_category;
...@@ -131,21 +127,21 @@ struct _List_iterator_base ...@@ -131,21 +127,21 @@ struct _List_iterator_base
bool bool
operator!=(const _List_iterator_base& __x) const operator!=(const _List_iterator_base& __x) const
{ return _M_node != __x._M_node; } { return _M_node != __x._M_node; }
}; };
/** /**
* @brief A list::iterator. * @brief A list::iterator.
* *
* In addition to being used externally, a list holds one of these internally, * In addition to being used externally, a list holds one of these
* pointing to the sequence of data. * internally, pointing to the sequence of data.
* *
* @if maint * @if maint
* All the functions are op overloads. * All the functions are op overloads.
* @endif * @endif
*/ */
template<typename _Tp, typename _Ref, typename _Ptr> template<typename _Tp, typename _Ref, typename _Ptr>
struct _List_iterator : public _List_iterator_base struct _List_iterator : public _List_iterator_base
{ {
typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator; typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
typedef _List_iterator<_Tp,_Ref,_Ptr> _Self; typedef _List_iterator<_Tp,_Ref,_Ptr> _Self;
...@@ -204,19 +200,19 @@ template<typename _Tp, typename _Ref, typename _Ptr> ...@@ -204,19 +200,19 @@ template<typename _Tp, typename _Ref, typename _Ptr>
this->_M_decr(); this->_M_decr();
return __tmp; return __tmp;
} }
}; };
/// @if maint Primary default version. @endif /// @if maint Primary default version. @endif
/** /**
* @if maint * @if maint
* See bits/stl_deque.h's _Deque_alloc_base for an explanation. * See bits/stl_deque.h's _Deque_alloc_base for an explanation.
* @endif * @endif
*/ */
template<typename _Tp, typename _Allocator, bool _IsStatic> template<typename _Tp, typename _Allocator, bool _IsStatic>
class _List_alloc_base class _List_alloc_base
{ {
public: public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type; allocator_type;
...@@ -227,7 +223,7 @@ public: ...@@ -227,7 +223,7 @@ public:
: _M_node_allocator(__a) : _M_node_allocator(__a)
{ } { }
protected: protected:
_List_node<_Tp>* _List_node<_Tp>*
_M_get_node() _M_get_node()
{ return _M_node_allocator.allocate(1); } { return _M_node_allocator.allocate(1); }
...@@ -252,13 +248,13 @@ protected: ...@@ -252,13 +248,13 @@ protected:
_M_node_allocator; _M_node_allocator;
_List_node<_Tp>* _M_node; _List_node<_Tp>* _M_node;
}; };
/// @if maint Specialization for instanceless allocators. @endif /// @if maint Specialization for instanceless allocators. @endif
template<typename _Tp, typename _Allocator> template<typename _Tp, typename _Allocator>
class _List_alloc_base<_Tp, _Allocator, true> class _List_alloc_base<_Tp, _Allocator, true>
{ {
public: public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type; allocator_type;
...@@ -268,7 +264,7 @@ public: ...@@ -268,7 +264,7 @@ public:
_List_alloc_base(const allocator_type&) _List_alloc_base(const allocator_type&)
{ } { }
protected: protected:
// See comment in primary template class about why this is safe for the // See comment in primary template class about why this is safe for the
// standard predefined classes. // standard predefined classes.
typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type
...@@ -283,20 +279,20 @@ protected: ...@@ -283,20 +279,20 @@ protected:
{ _Alloc_type::deallocate(__p, 1); } { _Alloc_type::deallocate(__p, 1); }
_List_node<_Tp>* _M_node; _List_node<_Tp>* _M_node;
}; };
/** /**
* @if maint * @if maint
* See bits/stl_deque.h's _Deque_base for an explanation. * See bits/stl_deque.h's _Deque_base for an explanation.
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
class _List_base class _List_base
: public _List_alloc_base<_Tp, _Alloc, : public _List_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{ {
public: public:
typedef _List_alloc_base<_Tp, _Alloc, typedef _List_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base; _Base;
...@@ -319,10 +315,10 @@ public: ...@@ -319,10 +315,10 @@ public:
void void
__clear(); __clear();
}; };
/** /**
* @brief A standard container with linear time access to elements, and * @brief A standard container with linear time access to elements, and
* fixed time insertion/deletion at any point in the sequence. * fixed time insertion/deletion at any point in the sequence.
* *
...@@ -349,7 +345,7 @@ public: ...@@ -349,7 +345,7 @@ public:
* @if maint * @if maint
* A couple points on memory allocation for list<Tp>: * A couple points on memory allocation for list<Tp>:
* *
* First, we never actually allocate a Tp, we actally allocate List_node<Tp>'s * First, we never actually allocate a Tp, we allocate List_node<Tp>'s
* and trust [20.1.5]/4 to DTRT. This is to ensure that after elements from * and trust [20.1.5]/4 to DTRT. This is to ensure that after elements from
* %list<X,Alloc1> are spliced into %list<X,Alloc2>, destroying the memory of * %list<X,Alloc1> are spliced into %list<X,Alloc2>, destroying the memory of
* the second %list is a valid operation, i.e., Alloc1 giveth and Alloc2 * the second %list is a valid operation, i.e., Alloc1 giveth and Alloc2
...@@ -365,16 +361,16 @@ public: ...@@ -365,16 +361,16 @@ public:
* and move forward by one. When this member iterator's next/previous * and move forward by one. When this member iterator's next/previous
* pointers refer to itself, the %list is %empty. * pointers refer to itself, the %list is %empty.
* @endif * @endif
*/ */
template<typename _Tp, typename _Alloc = allocator<_Tp> > template<typename _Tp, typename _Alloc = allocator<_Tp> >
class list : protected _List_base<_Tp, _Alloc> class list : protected _List_base<_Tp, _Alloc>
{ {
// concept requirements // concept requirements
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
typedef _List_base<_Tp, _Alloc> _Base; typedef _List_base<_Tp, _Alloc> _Base;
public: public:
typedef _Tp value_type; typedef _Tp value_type;
typedef value_type* pointer; typedef value_type* pointer;
typedef const value_type* const_pointer; typedef const value_type* const_pointer;
...@@ -388,7 +384,7 @@ public: ...@@ -388,7 +384,7 @@ public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
protected: protected:
// Note that pointers-to-_Node's can be ctor-converted to iterator types. // Note that pointers-to-_Node's can be ctor-converted to iterator types.
typedef _List_node<_Tp> _Node; typedef _List_node<_Tp> _Node;
...@@ -445,7 +441,7 @@ protected: ...@@ -445,7 +441,7 @@ protected:
return __p; return __p;
} }
public: public:
// [23.2.2.1] construct/copy/destroy // [23.2.2.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section) // (assign() and get_allocator() are also listed in this section)
/** /**
...@@ -520,8 +516,8 @@ public: ...@@ -520,8 +516,8 @@ public:
* @brief %List assignment operator. * @brief %List assignment operator.
* @param x A %list of identical element and allocator types. * @param x A %list of identical element and allocator types.
* *
* All the elements of @a x are copied, but unlike the copy constructor, the * All the elements of @a x are copied, but unlike the copy constructor,
* allocator object is not copied. * the allocator object is not copied.
*/ */
list& list&
operator=(const list& __x); operator=(const list& __x);
...@@ -706,14 +702,14 @@ public: ...@@ -706,14 +702,14 @@ public:
void void
push_front(const value_type& __x) { this->insert(begin(), __x); } push_front(const value_type& __x) { this->insert(begin(), __x); }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Add data to the front of the %list. * @brief Add data to the front of the %list.
* *
* This is a typical stack operation. The function creates a * This is a typical stack operation. The function creates a
* default-constructed element at the front of the %list. Due to the nature * default-constructed element at the front of the %list. Due to the
* of a %list this operation can be done in constant time. You should * nature of a %list this operation can be done in constant time. You
* consider using push_front(value_type()) instead. * should consider using push_front(value_type()) instead.
* *
* @note This was deprecated in 3.2 and will be removed in 3.4. You must * @note This was deprecated in 3.2 and will be removed in 3.4. You must
* define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see * define @c _GLIBCPP_DEPRECATED to make this visible in 3.2; see
...@@ -721,7 +717,7 @@ public: ...@@ -721,7 +717,7 @@ public:
*/ */
void void
push_front() { this->insert(begin(), value_type()); } push_front() { this->insert(begin(), value_type()); }
#endif #endif
/** /**
* @brief Removes first element. * @brief Removes first element.
...@@ -749,7 +745,7 @@ public: ...@@ -749,7 +745,7 @@ public:
void void
push_back(const value_type& __x) { this->insert(end(), __x); } push_back(const value_type& __x) { this->insert(end(), __x); }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Add data to the end of the %list. * @brief Add data to the end of the %list.
* *
...@@ -764,7 +760,7 @@ public: ...@@ -764,7 +760,7 @@ public:
*/ */
void void
push_back() { this->insert(end(), value_type()); } push_back() { this->insert(end(), value_type()); }
#endif #endif
/** /**
* @brief Removes last element. * @brief Removes last element.
...@@ -798,7 +794,7 @@ public: ...@@ -798,7 +794,7 @@ public:
iterator iterator
insert(iterator __position, const value_type& __x); insert(iterator __position, const value_type& __x);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Inserts an element into the %list. * @brief Inserts an element into the %list.
* @param position An iterator into the %list. * @param position An iterator into the %list.
...@@ -816,7 +812,7 @@ public: ...@@ -816,7 +812,7 @@ public:
*/ */
iterator iterator
insert(iterator __position) { return insert(__position, value_type()); } insert(iterator __position) { return insert(__position, value_type()); }
#endif #endif
/** /**
* @brief Inserts a number of copies of given data into the %list. * @brief Inserts a number of copies of given data into the %list.
...@@ -877,7 +873,8 @@ public: ...@@ -877,7 +873,8 @@ public:
/** /**
* @brief Remove a range of elements. * @brief Remove a range of elements.
* @param first Iterator pointing to the first element to be erased. * @param first Iterator pointing to the first element to be erased.
* @param last Iterator pointing to one past the last element to be erased. * @param last Iterator pointing to one past the last element to be
* erased.
* @return An iterator pointing to the element pointed to by @a last * @return An iterator pointing to the element pointed to by @a last
* prior to erasing (or end()). * prior to erasing (or end()).
* *
...@@ -1012,7 +1009,7 @@ public: ...@@ -1012,7 +1009,7 @@ public:
void void
sort(_StrictWeakOrdering); sort(_StrictWeakOrdering);
protected: protected:
// Internal assign functions follow. // Internal assign functions follow.
// called by the range assign to implement [23.1.1]/9 // called by the range assign to implement [23.1.1]/9
...@@ -1040,7 +1037,8 @@ protected: ...@@ -1040,7 +1037,8 @@ protected:
// called by the range insert to implement [23.1.1]/9 // called by the range insert to implement [23.1.1]/9
template<typename _Integer> template<typename _Integer>
void void
_M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, __true_type) _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
__true_type)
{ {
_M_fill_insert(__pos, static_cast<size_type>(__n), _M_fill_insert(__pos, static_cast<size_type>(__n),
static_cast<value_type>(__x)); static_cast<value_type>(__x));
...@@ -1084,10 +1082,10 @@ protected: ...@@ -1084,10 +1082,10 @@ protected:
__first._M_node->_M_prev = __tmp; __first._M_node->_M_prev = __tmp;
} }
} }
}; };
/** /**
* @brief List equality comparison. * @brief List equality comparison.
* @param x A %list. * @param x A %list.
* @param y A %list of the same type as @a x. * @param y A %list of the same type as @a x.
...@@ -1096,9 +1094,9 @@ protected: ...@@ -1096,9 +1094,9 @@ protected:
* This is an equivalence relation. It is linear in the size of the * This is an equivalence relation. It is linear in the size of the
* lists. Lists are considered equivalent if their sizes are equal, * lists. Lists are considered equivalent if their sizes are equal,
* and if corresponding elements compare equal. * and if corresponding elements compare equal.
*/ */
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)
{ {
typedef typename list<_Tp,_Alloc>::const_iterator const_iterator; typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
...@@ -1114,7 +1112,7 @@ inline bool ...@@ -1114,7 +1112,7 @@ inline bool
return __i1 == __end1 && __i2 == __end2; return __i1 == __end1 && __i2 == __end2;
} }
/** /**
* @brief List ordering relation. * @brief List ordering relation.
* @param x A %list. * @param x A %list.
* @param y A %list of the same type as @a x. * @param y A %list of the same type as @a x.
...@@ -1124,8 +1122,8 @@ inline bool ...@@ -1124,8 +1122,8 @@ inline bool
* lists. The elements must be comparable with @c <. * lists. The elements must be comparable with @c <.
* *
* See std::lexographical_compare() for how the determination is made. * See std::lexographical_compare() for how the determination is made.
*/ */
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)
{ {
...@@ -1133,37 +1131,35 @@ template<typename _Tp, typename _Alloc> ...@@ -1133,37 +1131,35 @@ template<typename _Tp, typename _Alloc>
__y.begin(), __y.end()); __y.begin(), __y.end());
} }
/// Based on operator== /// Based on operator==
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 !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
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 __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
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 !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
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 !(__x < __y); } { return !(__x < __y); }
/// See std::list::swap(). /// See std::list::swap().
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_LIST_H */ #endif /* __GLIBCPP_INTERNAL_LIST_H */
...@@ -63,13 +63,9 @@ ...@@ -63,13 +63,9 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
/**
/**
* @brief A standard container made up of (key,value) pairs, which can be * @brief A standard container made up of (key,value) pairs, which can be
* retrieved based on a key, in logarithmic time. * retrieved based on a key, in logarithmic time.
* *
...@@ -89,16 +85,16 @@ namespace std ...@@ -89,16 +85,16 @@ namespace std
* multimap; the distinction is made entirely in how the tree functions are * multimap; the distinction is made entirely in how the tree functions are
* called (*_unique versus *_equal, same as the standard). * called (*_unique versus *_equal, same as the standard).
* @endif * @endif
*/ */
template <typename _Key, typename _Tp, typename _Compare = less<_Key>, template <typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Alloc = allocator<pair<const _Key, _Tp> > > typename _Alloc = allocator<pair<const _Key, _Tp> > >
class map class map
{ {
// concept requirements // concept requirements
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
__glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept)
public: public:
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef pair<const _Key, _Tp> value_type; typedef pair<const _Key, _Tp> value_type;
...@@ -116,14 +112,14 @@ public: ...@@ -116,14 +112,14 @@ public:
{ return comp(__x.first, __y.first); } { return comp(__x.first, __y.first); }
}; };
private: private:
/// @if maint This turns a red-black tree into a [multi]map. @endif /// @if maint This turns a red-black tree into a [multi]map. @endif
typedef _Rb_tree<key_type, value_type, typedef _Rb_tree<key_type, value_type,
_Select1st<value_type>, key_compare, _Alloc> _Rep_type; _Select1st<value_type>, key_compare, _Alloc> _Rep_type;
/// @if maint The actual tree structure. @endif /// @if maint The actual tree structure. @endif
_Rep_type _M_t; _Rep_type _M_t;
public: public:
// many of these are specified differently in ISO, but the following are // many of these are specified differently in ISO, but the following are
// "functionally equivalent" // "functionally equivalent"
typedef typename _Rep_type::allocator_type allocator_type; typedef typename _Rep_type::allocator_type allocator_type;
...@@ -209,8 +205,8 @@ public: ...@@ -209,8 +205,8 @@ public:
* @brief Map assignment operator. * @brief Map assignment operator.
* @param x A %map of identical element and allocator types. * @param x A %map of identical element and allocator types.
* *
* All the elements of @a x are copied, but unlike the copy constructor, the * All the elements of @a x are copied, but unlike the copy constructor,
* allocator object is not copied. * the allocator object is not copied.
*/ */
map& map&
operator=(const map& __x) operator=(const map& __x)
...@@ -233,7 +229,8 @@ public: ...@@ -233,7 +229,8 @@ public:
/** /**
* Returns a read-only (constant) iterator that points to the first pair * Returns a read-only (constant) iterator that points to the first pair
* in the %map. Iteration is done in ascending order according to the keys. * in the %map. Iteration is done in ascending order according to the
* keys.
*/ */
const_iterator const_iterator
begin() const { return _M_t.begin(); } begin() const { return _M_t.begin(); }
...@@ -278,8 +275,8 @@ public: ...@@ -278,8 +275,8 @@ public:
/** /**
* Returns a read-only (constant) reverse iterator that points to one * Returns a read-only (constant) reverse iterator that points to one
* before the first pair in the %map. Iteration is done in descending order * before the first pair in the %map. Iteration is done in descending
* according to the keys. * order according to the keys.
*/ */
const_reverse_iterator const_reverse_iterator
rend() const { return _M_t.rend(); } rend() const { return _M_t.rend(); }
...@@ -332,9 +329,9 @@ public: ...@@ -332,9 +329,9 @@ public:
* to the possibly inserted pair, and the second is a bool that * to the possibly inserted pair, and the second is a bool that
* is true if the pair was actually inserted. * is true if the pair was actually inserted.
* *
* This function attempts to insert a (key, value) %pair into the %map. A * This function attempts to insert a (key, value) %pair into the %map.
* %map relies on unique keys and thus a %pair is only inserted if its first * A %map relies on unique keys and thus a %pair is only inserted if its
* element (the key) is not already present in the %map. * first element (the key) is not already present in the %map.
* *
* Insertion requires logarithmic time. * Insertion requires logarithmic time.
*/ */
...@@ -368,7 +365,8 @@ public: ...@@ -368,7 +365,8 @@ public:
/** /**
* @brief A template function that attemps to insert a range of elements. * @brief A template function that attemps to insert a range of elements.
* @param first Iterator pointing to the start of the range to be inserted. * @param first Iterator pointing to the start of the range to be
* inserted.
* @param last Iterator pointing to the end of the range. * @param last Iterator pointing to the end of the range.
* *
* Complexity similar to that of the range constructor. * Complexity similar to that of the range constructor.
...@@ -589,10 +587,10 @@ public: ...@@ -589,10 +587,10 @@ public:
template <typename _K1, typename _T1, typename _C1, typename _A1> template <typename _K1, typename _T1, typename _C1, typename _A1>
friend bool operator< (const map<_K1,_T1,_C1,_A1>&, friend bool operator< (const map<_K1,_T1,_C1,_A1>&,
const map<_K1,_T1,_C1,_A1>&); const map<_K1,_T1,_C1,_A1>&);
}; };
/** /**
* @brief Map equality comparison. * @brief Map equality comparison.
* @param x A %map. * @param x A %map.
* @param y A %map of the same type as @a x. * @param y A %map of the same type as @a x.
...@@ -601,14 +599,14 @@ public: ...@@ -601,14 +599,14 @@ public:
* This is an equivalence relation. It is linear in the size of the * This is an equivalence relation. It is linear in the size of the
* maps. Maps are considered equivalent if their sizes are equal, * maps. Maps are considered equivalent if their sizes are equal,
* and if corresponding elements compare equal. * and if corresponding elements compare equal.
*/ */
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return __x._M_t == __y._M_t; } { return __x._M_t == __y._M_t; }
/** /**
* @brief Map ordering relation. * @brief Map ordering relation.
* @param x A %map. * @param x A %map.
* @param y A %map of the same type as @a x. * @param y A %map of the same type as @a x.
...@@ -618,48 +616,46 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> ...@@ -618,48 +616,46 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
* maps. The elements must be comparable with @c <. * maps. The elements must be comparable with @c <.
* *
* See std::lexographical_compare() for how the determination is made. * See std::lexographical_compare() for how the determination is made.
*/ */
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return __x._M_t < __y._M_t; } { return __x._M_t < __y._M_t; }
/// Based on operator== /// Based on operator==
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator>(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator>(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator<=(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator<=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator>=(const map<_Key,_Tp,_Compare,_Alloc>& __x, operator>=(const map<_Key,_Tp,_Compare,_Alloc>& __x,
const map<_Key,_Tp,_Compare,_Alloc>& __y) const map<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
/// See std::map::swap(). /// See std::map::swap().
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void inline void
swap(map<_Key,_Tp,_Compare,_Alloc>& __x, map<_Key,_Tp,_Compare,_Alloc>& __y) swap(map<_Key,_Tp,_Compare,_Alloc>& __x, map<_Key,_Tp,_Compare,_Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_MAP_H */ #endif /* __GLIBCPP_INTERNAL_MAP_H */
...@@ -63,28 +63,24 @@ ...@@ -63,28 +63,24 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
// Forward declaration of operators < and ==, needed for friend declaration.
// Forward declaration of operators < and ==, needed for friend declaration. template <typename _Key, typename _Tp,
template <typename _Key, typename _Tp,
typename _Compare = less<_Key>, typename _Compare = less<_Key>,
typename _Alloc = allocator<pair<const _Key, _Tp> > > typename _Alloc = allocator<pair<const _Key, _Tp> > >
class multimap; class multimap;
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y); const multimap<_Key,_Tp,_Compare,_Alloc>& __y);
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y); const multimap<_Key,_Tp,_Compare,_Alloc>& __y);
/** /**
* @brief A standard container made up of (key,value) pairs, which can be * @brief A standard container made up of (key,value) pairs, which can be
* retrieved based on a key, in logarithmic time. * retrieved based on a key, in logarithmic time.
* *
...@@ -93,9 +89,9 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, ...@@ -93,9 +89,9 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
* *
* Meets the requirements of a <a href="tables.html#65">container</a>, a * Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and an * <a href="tables.html#66">reversible container</a>, and an
* <a href="tables.html#69">associative container</a> (using equivalent keys). * <a href="tables.html#69">associative container</a> (using equivalent
* For a @c multimap<Key,T> the key_type is Key, the mapped_type is T, and * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type
* the value_type is std::pair<const Key,T>. * is T, and the value_type is std::pair<const Key,T>.
* *
* Multimaps support bidirectional iterators. * Multimaps support bidirectional iterators.
* *
...@@ -104,15 +100,15 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, ...@@ -104,15 +100,15 @@ inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
* multimap; the distinction is made entirely in how the tree functions are * multimap; the distinction is made entirely in how the tree functions are
* called (*_unique versus *_equal, same as the standard). * called (*_unique versus *_equal, same as the standard).
* @endif * @endif
*/ */
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
class multimap class multimap
{ {
// concept requirements // concept requirements
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
__glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept)
public: public:
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef pair<const _Key, _Tp> value_type; typedef pair<const _Key, _Tp> value_type;
...@@ -130,14 +126,14 @@ public: ...@@ -130,14 +126,14 @@ public:
{ return comp(__x.first, __y.first); } { return comp(__x.first, __y.first); }
}; };
private: private:
/// @if maint This turns a red-black tree into a [multi]map. @endif /// @if maint This turns a red-black tree into a [multi]map. @endif
typedef _Rb_tree<key_type, value_type, typedef _Rb_tree<key_type, value_type,
_Select1st<value_type>, key_compare, _Alloc> _Rep_type; _Select1st<value_type>, key_compare, _Alloc> _Rep_type;
/// @if maint The actual tree structure. @endif /// @if maint The actual tree structure. @endif
_Rep_type _M_t; _Rep_type _M_t;
public: public:
// many of these are specified differently in ISO, but the following are // many of these are specified differently in ISO, but the following are
// "functionally equivalent" // "functionally equivalent"
typedef typename _Rep_type::allocator_type allocator_type; typedef typename _Rep_type::allocator_type allocator_type;
...@@ -199,9 +195,9 @@ public: ...@@ -199,9 +195,9 @@ public:
* @param comp A comparison functor. * @param comp A comparison functor.
* @param a An allocator object. * @param a An allocator object.
* *
* Create a %multimap consisting of copies of the elements from [first,last). * Create a %multimap consisting of copies of the elements from
* This is linear in N if the range is already sorted, and NlogN * [first,last). This is linear in N if the range is already sorted,
* otherwise (where N is distance(first,last)). * and NlogN otherwise (where N is distance(first,last)).
*/ */
template <typename _InputIterator> template <typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last, multimap(_InputIterator __first, _InputIterator __last,
...@@ -223,8 +219,8 @@ public: ...@@ -223,8 +219,8 @@ public:
* @brief %Multimap assignment operator. * @brief %Multimap assignment operator.
* @param x A %multimap of identical element and allocator types. * @param x A %multimap of identical element and allocator types.
* *
* All the elements of @a x are copied, but unlike the copy constructor, the * All the elements of @a x are copied, but unlike the copy constructor,
* allocator object is not copied. * the allocator object is not copied.
*/ */
multimap& multimap&
operator=(const multimap& __x) operator=(const multimap& __x)
...@@ -355,7 +351,8 @@ public: ...@@ -355,7 +351,8 @@ public:
/** /**
* @brief A template function that attemps to insert a range of elements. * @brief A template function that attemps to insert a range of elements.
* @param first Iterator pointing to the start of the range to be inserted. * @param first Iterator pointing to the start of the range to be
* inserted.
* @param last Iterator pointing to the end of the range. * @param last Iterator pointing to the end of the range.
* *
* Complexity similar to that of the range constructor. * Complexity similar to that of the range constructor.
...@@ -562,10 +559,10 @@ public: ...@@ -562,10 +559,10 @@ public:
template <typename _K1, typename _T1, typename _C1, typename _A1> template <typename _K1, typename _T1, typename _C1, typename _A1>
friend bool operator< (const multimap<_K1,_T1,_C1,_A1>&, friend bool operator< (const multimap<_K1,_T1,_C1,_A1>&,
const multimap<_K1,_T1,_C1,_A1>&); const multimap<_K1,_T1,_C1,_A1>&);
}; };
/** /**
* @brief Multimap equality comparison. * @brief Multimap equality comparison.
* @param x A %multimap. * @param x A %multimap.
* @param y A %multimap of the same type as @a x. * @param y A %multimap of the same type as @a x.
...@@ -574,8 +571,8 @@ public: ...@@ -574,8 +571,8 @@ public:
* This is an equivalence relation. It is linear in the size of the * This is an equivalence relation. It is linear in the size of the
* multimaps. Multimaps are considered equivalent if their sizes are equal, * multimaps. Multimaps are considered equivalent if their sizes are equal,
* and if corresponding elements compare equal. * and if corresponding elements compare equal.
*/ */
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
...@@ -583,7 +580,7 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> ...@@ -583,7 +580,7 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
return __x._M_t == __y._M_t; return __x._M_t == __y._M_t;
} }
/** /**
* @brief Multimap ordering relation. * @brief Multimap ordering relation.
* @param x A %multimap. * @param x A %multimap.
* @param y A %multimap of the same type as @a x. * @param y A %multimap of the same type as @a x.
...@@ -593,49 +590,47 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> ...@@ -593,49 +590,47 @@ template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
* multimaps. The elements must be comparable with @c <. * multimaps. The elements must be comparable with @c <.
* *
* See std::lexographical_compare() for how the determination is made. * See std::lexographical_compare() for how the determination is made.
*/ */
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ return __x._M_t < __y._M_t; } { return __x._M_t < __y._M_t; }
/// Based on operator== /// Based on operator==
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline bool inline bool
operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
const multimap<_Key,_Tp,_Compare,_Alloc>& __y) const multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
/// See std::multimap::swap(). /// See std::multimap::swap().
template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
inline void inline void
swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x, swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
multimap<_Key,_Tp,_Compare,_Alloc>& __y) multimap<_Key,_Tp,_Compare,_Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_MULTIMAP_H */ #endif /* __GLIBCPP_INTERNAL_MULTIMAP_H */
...@@ -63,31 +63,28 @@ ...@@ -63,31 +63,28 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
// Forward declarations of operators < and ==, needed for friend declaration.
// Forward declarations of operators < and ==, needed for friend declaration. template <typename _Tp, typename _Sequence = deque<_Tp> >
class queue;
template <typename _Tp, typename _Sequence = deque<_Tp> > template <typename _Tp, typename _Seq>
class queue; inline bool operator==(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&);
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool operator==(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&); inline bool 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>&);
/**
/**
* @brief A standard container giving FIFO behavior. * @brief A standard container giving FIFO behavior.
* *
* @ingroup Containers * @ingroup Containers
* @ingroup Sequences * @ingroup Sequences
* *
* Meets many of the requirements of a <a href="tables.html#65">container</a>, * Meets many of the requirements of a
* <a href="tables.html#65">container</a>,
* but does not define anything to do with iterators. Very few of the * but does not define anything to do with iterators. Very few of the
* other standard container interfaces are defined. * other standard container interfaces are defined.
* *
...@@ -103,10 +100,10 @@ inline bool operator<(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&); ...@@ -103,10 +100,10 @@ inline bool operator<(const queue<_Tp,_Seq>&, const queue<_Tp,_Seq>&);
* Members not found in "normal" containers are @c container_type, * Members not found in "normal" containers are @c container_type,
* which is a typedef for the second Sequence parameter, and @c push and * which is a typedef for the second Sequence parameter, and @c push and
* @c pop, which are standard %queue/FIFO operations. * @c pop, which are standard %queue/FIFO operations.
*/ */
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
class queue class queue
{ {
// concept requirements // concept requirements
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
...@@ -121,14 +118,14 @@ template <typename _Tp, typename _Sequence> ...@@ -121,14 +118,14 @@ template <typename _Tp, typename _Sequence>
friend bool operator< (const queue<_Tp1, _Seq1>&, friend bool operator< (const queue<_Tp1, _Seq1>&,
const queue<_Tp1, _Seq1>&); const queue<_Tp1, _Seq1>&);
public: public:
typedef typename _Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::reference reference; typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::const_reference const_reference;
typedef typename _Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef _Sequence container_type; typedef _Sequence container_type;
protected: protected:
/** /**
* 'c' is the underlying container. Maintainers wondering why this isn't * 'c' is the underlying container. Maintainers wondering why this isn't
* uglified as per style guidelines should note that this name is * uglified as per style guidelines should note that this name is
...@@ -138,7 +135,7 @@ protected: ...@@ -138,7 +135,7 @@ protected:
*/ */
_Sequence c; _Sequence c;
public: public:
/** /**
* @brief Default constructor creates no elements. * @brief Default constructor creates no elements.
*/ */
...@@ -208,10 +205,10 @@ public: ...@@ -208,10 +205,10 @@ public:
*/ */
void void
pop() { c.pop_front(); } pop() { c.pop_front(); }
}; };
/** /**
* @brief Queue equality comparison. * @brief Queue equality comparison.
* @param x A %queue. * @param x A %queue.
* @param y A %queue of the same type as @a x. * @param y A %queue of the same type as @a x.
...@@ -221,55 +218,55 @@ public: ...@@ -221,55 +218,55 @@ public:
* underlying sequence type, but the expected rules are: this relation is * underlying sequence type, but the expected rules are: this relation is
* linear in the size of the sequences, and queues are considered equivalent * linear in the size of the sequences, and queues are considered equivalent
* if their sequences compare equal. * if their sequences compare equal.
*/ */
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator==(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return __x.c == __y.c; } { return __x.c == __y.c; }
/** /**
* @brief Queue ordering relation. * @brief Queue ordering relation.
* @param x A %queue. * @param x A %queue.
* @param y A %queue of the same type as @a x. * @param y A %queue of the same type as @a x.
* @return True iff @a x is lexographically less than @a y. * @return True iff @a x is lexographically less than @a y.
* *
* This is an total ordering relation. Complexity and semantics depend on the * This is an total ordering relation. Complexity and semantics depend on
* underlying sequence type, but the expected rules are: this relation is * the underlying sequence type, but the expected rules are: this relation
* linear in the size of the sequences, the elements must be comparable * is linear in the size of the sequences, the elements must be comparable
* with @c <, and std::lexographical_compare() is usually used to make the * with @c <, and std::lexographical_compare() is usually used to make the
* determination. * determination.
*/ */
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator<(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return __x.c < __y.c; } { return __x.c < __y.c; }
/// Based on operator== /// Based on operator==
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator!=(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator>(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator<=(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
inline bool inline bool
operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) operator>=(const queue<_Tp,_Sequence>& __x, const queue<_Tp,_Sequence>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
/** /**
* @brief A standard container automatically sorting its contents. * @brief A standard container automatically sorting its contents.
* *
* @ingroup Containers * @ingroup Containers
...@@ -302,11 +299,11 @@ template <typename _Tp, typename _Sequence> ...@@ -302,11 +299,11 @@ template <typename _Tp, typename _Sequence>
* change their data such that the sorting order would be different, * change their data such that the sorting order would be different,
* the %priority_queue will not re-sort the elements for you. (How * the %priority_queue will not re-sort the elements for you. (How
* could it know to do so?) * could it know to do so?)
*/ */
template <typename _Tp, typename _Sequence = vector<_Tp>, template <typename _Tp, typename _Sequence = vector<_Tp>,
typename _Compare = less<typename _Sequence::value_type> > typename _Compare = less<typename _Sequence::value_type> >
class priority_queue class priority_queue
{ {
// concept requirements // concept requirements
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
...@@ -315,19 +312,19 @@ template <typename _Tp, typename _Sequence = vector<_Tp>, ...@@ -315,19 +312,19 @@ template <typename _Tp, typename _Sequence = vector<_Tp>,
__glibcpp_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) __glibcpp_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
__glibcpp_class_requires4(_Compare, bool, _Tp, _Tp, _BinaryFunctionConcept) __glibcpp_class_requires4(_Compare, bool, _Tp, _Tp, _BinaryFunctionConcept)
public: public:
typedef typename _Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::reference reference; typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::const_reference const_reference;
typedef typename _Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef _Sequence container_type; typedef _Sequence container_type;
protected: protected:
// See queue::c for notes on these names. // See queue::c for notes on these names.
_Sequence c; _Sequence c;
_Compare comp; _Compare comp;
public: public:
/** /**
* @brief Default constructor creates no elements. * @brief Default constructor creates no elements.
*/ */
...@@ -425,11 +422,9 @@ public: ...@@ -425,11 +422,9 @@ public:
__throw_exception_again; __throw_exception_again;
} }
} }
}; };
// No equality/comparison operators are provided for priority_queue.
// No equality/comparison operators are provided for priority_queue.
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_QUEUE_H */ #endif /* __GLIBCPP_INTERNAL_QUEUE_H */
...@@ -63,31 +63,29 @@ ...@@ -63,31 +63,29 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
// Forward declarations of operators == and <, needed for friend declaration.
// Forward declarations of operators == and <, needed for friend declaration. template <typename _Tp, typename _Sequence = deque<_Tp> >
class stack;
template <typename _Tp, typename _Sequence = deque<_Tp> > template <typename _Tp, typename _Seq>
class stack; inline bool operator==(const stack<_Tp,_Seq>& __x,
const stack<_Tp,_Seq>& __y);
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); inline bool 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);
/**
/**
* @brief A standard container giving FILO behavior. * @brief A standard container giving FILO behavior.
* *
* @ingroup Containers * @ingroup Containers
* @ingroup Sequences * @ingroup Sequences
* *
* Meets many of the requirements of a <a href="tables.html#65">container</a>, * Meets many of the requirements of a
* <a href="tables.html#65">container</a>,
* but does not define anything to do with iterators. Very few of the * but does not define anything to do with iterators. Very few of the
* other standard container interfaces are defined. * other standard container interfaces are defined.
* *
...@@ -103,10 +101,10 @@ inline bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); ...@@ -103,10 +101,10 @@ inline bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y);
* Members not found in "normal" containers are @c container_type, * Members not found in "normal" containers are @c container_type,
* which is a typedef for the second Sequence parameter, and @c push, * which is a typedef for the second Sequence parameter, and @c push,
* @c pop, and @c top, which are standard %stack/FILO operations. * @c pop, and @c top, which are standard %stack/FILO operations.
*/ */
template <typename _Tp, typename _Sequence> template <typename _Tp, typename _Sequence>
class stack class stack
{ {
// concept requirements // concept requirements
typedef typename _Sequence::value_type _Sequence_value_type; typedef typename _Sequence::value_type _Sequence_value_type;
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
...@@ -120,18 +118,18 @@ template <typename _Tp, typename _Sequence> ...@@ -120,18 +118,18 @@ template <typename _Tp, typename _Sequence>
friend bool operator< (const stack<_Tp1, _Seq1>&, friend bool operator< (const stack<_Tp1, _Seq1>&,
const stack<_Tp1, _Seq1>&); const stack<_Tp1, _Seq1>&);
public: public:
typedef typename _Sequence::value_type value_type; typedef typename _Sequence::value_type value_type;
typedef typename _Sequence::reference reference; typedef typename _Sequence::reference reference;
typedef typename _Sequence::const_reference const_reference; typedef typename _Sequence::const_reference const_reference;
typedef typename _Sequence::size_type size_type; typedef typename _Sequence::size_type size_type;
typedef _Sequence container_type; typedef _Sequence container_type;
protected: protected:
// See queue::c for notes on this name. // See queue::c for notes on this name.
_Sequence c; _Sequence c;
public: public:
// XXX removed old def ctor, added def arg to this one to match 14882 // XXX removed old def ctor, added def arg to this one to match 14882
/** /**
* @brief Default constructor creates no elements. * @brief Default constructor creates no elements.
...@@ -188,10 +186,10 @@ public: ...@@ -188,10 +186,10 @@ public:
*/ */
void void
pop() { c.pop_back(); } pop() { c.pop_back(); }
}; };
/** /**
* @brief Stack equality comparison. * @brief Stack equality comparison.
* @param x A %stack. * @param x A %stack.
* @param y A %stack of the same type as @a x. * @param y A %stack of the same type as @a x.
...@@ -201,54 +199,52 @@ public: ...@@ -201,54 +199,52 @@ public:
* underlying sequence type, but the expected rules are: this relation is * underlying sequence type, but the expected rules are: this relation is
* linear in the size of the sequences, and stacks are considered equivalent * linear in the size of the sequences, and stacks are considered equivalent
* if their sequences compare equal. * if their sequences compare equal.
*/ */
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return __x.c == __y.c; } { return __x.c == __y.c; }
/** /**
* @brief Stack ordering relation. * @brief Stack ordering relation.
* @param x A %stack. * @param x A %stack.
* @param y A %stack of the same type as @a x. * @param y A %stack of the same type as @a x.
* @return True iff @a x is lexographically less than @a y. * @return True iff @a x is lexographically less than @a y.
* *
* This is an total ordering relation. Complexity and semantics depend on the * This is an total ordering relation. Complexity and semantics depend on
* underlying sequence type, but the expected rules are: this relation is * the underlying sequence type, but the expected rules are: this relation
* linear in the size of the sequences, the elements must be comparable * is linear in the size of the sequences, the elements must be comparable
* with @c <, and std::lexographical_compare() is usually used to make the * with @c <, and std::lexographical_compare() is usually used to make the
* determination. * determination.
*/ */
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return __x.c < __y.c; } { return __x.c < __y.c; }
/// Based on operator== /// Based on operator==
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Seq> template <typename _Tp, typename _Seq>
inline bool inline bool
operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_STACK_H */ #endif /* __GLIBCPP_INTERNAL_STACK_H */
...@@ -65,22 +65,18 @@ ...@@ -65,22 +65,18 @@
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <bits/concept_check.h> #include <bits/concept_check.h>
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
/// @if maint Primary default version. @endif
/// @if maint Primary default version. @endif /**
/**
* @if maint * @if maint
* See bits/stl_deque.h's _Deque_alloc_base for an explanation. * See bits/stl_deque.h's _Deque_alloc_base for an explanation.
* @endif * @endif
*/ */
template <typename _Tp, typename _Allocator, bool _IsStatic> template <typename _Tp, typename _Allocator, bool _IsStatic>
class _Vector_alloc_base class _Vector_alloc_base
{ {
public: public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type; allocator_type;
...@@ -91,7 +87,7 @@ public: ...@@ -91,7 +87,7 @@ public:
: _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) : _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{} {}
protected: protected:
allocator_type _M_data_allocator; allocator_type _M_data_allocator;
_Tp* _M_start; _Tp* _M_start;
_Tp* _M_finish; _Tp* _M_finish;
...@@ -103,13 +99,13 @@ protected: ...@@ -103,13 +99,13 @@ protected:
void void
_M_deallocate(_Tp* __p, size_t __n) _M_deallocate(_Tp* __p, size_t __n)
{ if (__p) _M_data_allocator.deallocate(__p, __n); } { if (__p) _M_data_allocator.deallocate(__p, __n); }
}; };
/// @if maint Specialization for instanceless allocators. @endif /// @if maint Specialization for instanceless allocators. @endif
template <typename _Tp, typename _Allocator> template <typename _Tp, typename _Allocator>
class _Vector_alloc_base<_Tp, _Allocator, true> class _Vector_alloc_base<_Tp, _Allocator, true>
{ {
public: public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type; allocator_type;
...@@ -120,7 +116,7 @@ public: ...@@ -120,7 +116,7 @@ public:
: _M_start(0), _M_finish(0), _M_end_of_storage(0) : _M_start(0), _M_finish(0), _M_end_of_storage(0)
{} {}
protected: protected:
_Tp* _M_start; _Tp* _M_start;
_Tp* _M_finish; _Tp* _M_finish;
_Tp* _M_end_of_storage; _Tp* _M_end_of_storage;
...@@ -132,20 +128,20 @@ protected: ...@@ -132,20 +128,20 @@ protected:
void void
_M_deallocate(_Tp* __p, size_t __n) { _Alloc_type::deallocate(__p, __n);} _M_deallocate(_Tp* __p, size_t __n) { _Alloc_type::deallocate(__p, __n);}
}; };
/** /**
* @if maint * @if maint
* See bits/stl_deque.h's _Deque_base for an explanation. * See bits/stl_deque.h's _Deque_base for an explanation.
* @endif * @endif
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
struct _Vector_base struct _Vector_base
: public _Vector_alloc_base<_Tp, _Alloc, : public _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{ {
public: public:
typedef _Vector_alloc_base<_Tp, _Alloc, typedef _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless> _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base; _Base;
...@@ -162,10 +158,10 @@ public: ...@@ -162,10 +158,10 @@ public:
} }
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
}; };
/** /**
* @brief A standard container which offers fixed time access to individual * @brief A standard container which offers fixed time access to individual
* elements in any order. * elements in any order.
* *
...@@ -182,17 +178,17 @@ public: ...@@ -182,17 +178,17 @@ public:
* it offers fast and efficient access to individual elements in any order * it offers fast and efficient access to individual elements in any order
* and saves the user from worrying about memory and size allocation. * and saves the user from worrying about memory and size allocation.
* Subscripting ( @c [] ) access is also provided as with C-style arrays. * Subscripting ( @c [] ) access is also provided as with C-style arrays.
*/ */
template <typename _Tp, typename _Alloc = allocator<_Tp> > template <typename _Tp, typename _Alloc = allocator<_Tp> >
class vector : protected _Vector_base<_Tp, _Alloc> class vector : protected _Vector_base<_Tp, _Alloc>
{ {
// concept requirements // concept requirements
__glibcpp_class_requires(_Tp, _SGIAssignableConcept) __glibcpp_class_requires(_Tp, _SGIAssignableConcept)
typedef _Vector_base<_Tp, _Alloc> _Base; typedef _Vector_base<_Tp, _Alloc> _Base;
typedef vector<_Tp, _Alloc> vector_type; typedef vector<_Tp, _Alloc> vector_type;
public: public:
typedef _Tp value_type; typedef _Tp value_type;
typedef value_type* pointer; typedef value_type* pointer;
typedef const value_type* const_pointer; typedef const value_type* const_pointer;
...@@ -207,7 +203,7 @@ public: ...@@ -207,7 +203,7 @@ public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
protected: protected:
/** @if maint /** @if maint
* These two functions and three data members are all from the top-most * These two functions and three data members are all from the top-most
* base class, which varies depending on the type of %allocator. They * base class, which varies depending on the type of %allocator. They
...@@ -221,7 +217,7 @@ protected: ...@@ -221,7 +217,7 @@ protected:
using _Base::_M_finish; using _Base::_M_finish;
using _Base::_M_end_of_storage; using _Base::_M_end_of_storage;
public: public:
// [23.2.4.1] construct/copy/destroy // [23.2.4.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section) // (assign() and get_allocator() are also listed in this section)
/** /**
...@@ -502,7 +498,7 @@ public: ...@@ -502,7 +498,7 @@ public:
const_reference const_reference
operator[](size_type __n) const { return *(begin() + __n); } operator[](size_type __n) const { return *(begin() + __n); }
protected: protected:
/// @if maint Safety check used only from at(). @endif /// @if maint Safety check used only from at(). @endif
void void
_M_range_check(size_type __n) const _M_range_check(size_type __n) const
...@@ -511,7 +507,7 @@ protected: ...@@ -511,7 +507,7 @@ protected:
__throw_out_of_range("vector [] access out of range"); __throw_out_of_range("vector [] access out of range");
} }
public: public:
/** /**
* @brief Provides access to the data contained in the %vector. * @brief Provides access to the data contained in the %vector.
* @param n The index of the element for which data should be accessed. * @param n The index of the element for which data should be accessed.
...@@ -617,7 +613,7 @@ public: ...@@ -617,7 +613,7 @@ public:
iterator iterator
insert(iterator __position, const value_type& __x); insert(iterator __position, const value_type& __x);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
/** /**
* @brief Inserts an element into the %vector. * @brief Inserts an element into the %vector.
* @param position An iterator into the %vector. * @param position An iterator into the %vector.
...@@ -636,7 +632,7 @@ public: ...@@ -636,7 +632,7 @@ public:
iterator iterator
insert(iterator __position) insert(iterator __position)
{ return insert(__position, value_type()); } { return insert(__position, value_type()); }
#endif #endif
/** /**
* @brief Inserts a number of copies of given data into the %vector. * @brief Inserts a number of copies of given data into the %vector.
...@@ -695,7 +691,8 @@ public: ...@@ -695,7 +691,8 @@ public:
/** /**
* @brief Remove a range of elements. * @brief Remove a range of elements.
* @param first Iterator pointing to the first element to be erased. * @param first Iterator pointing to the first element to be erased.
* @param last Iterator pointing to one past the last element to be erased. * @param last Iterator pointing to one past the last element to be
* erased.
* @return An iterator pointing to the element pointed to by @a last * @return An iterator pointing to the element pointed to by @a last
* prior to erasing (or end()). * prior to erasing (or end()).
* *
...@@ -737,7 +734,7 @@ public: ...@@ -737,7 +734,7 @@ public:
void void
clear() { erase(begin(), end()); } clear() { erase(begin(), end()); }
protected: protected:
/** /**
* @if maint * @if maint
* Memory expansion handler. Uses the member allocation function to * Memory expansion handler. Uses the member allocation function to
...@@ -778,7 +775,8 @@ protected: ...@@ -778,7 +775,8 @@ protected:
// called by the range constructor to implement [23.1.1]/9 // called by the range constructor to implement [23.1.1]/9
template<typename _InputIter> template<typename _InputIter>
void void
_M_initialize_dispatch(_InputIter __first, _InputIter __last, __false_type) _M_initialize_dispatch(_InputIter __first, _InputIter __last,
__false_type)
{ {
typedef typename iterator_traits<_InputIter>::iterator_category typedef typename iterator_traits<_InputIter>::iterator_category
_IterCategory; _IterCategory;
...@@ -893,14 +891,14 @@ protected: ...@@ -893,14 +891,14 @@ protected:
void void
_M_insert_aux(iterator __position, const value_type& __x); _M_insert_aux(iterator __position, const value_type& __x);
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
// unused now (same situation as in deque) // unused now (same situation as in deque)
void _M_insert_aux(iterator __position); void _M_insert_aux(iterator __position);
#endif #endif
}; };
/** /**
* @brief Vector equality comparison. * @brief Vector equality comparison.
* @param x A %vector. * @param x A %vector.
* @param y A %vector of the same type as @a x. * @param y A %vector of the same type as @a x.
...@@ -909,8 +907,8 @@ protected: ...@@ -909,8 +907,8 @@ protected:
* This is an equivalence relation. It is linear in the size of the * This is an equivalence relation. It is linear in the size of the
* vectors. Vectors are considered equivalent if their sizes are equal, * vectors. Vectors are considered equivalent if their sizes are equal,
* and if corresponding elements compare equal. * and if corresponding elements compare equal.
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator==(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator==(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ {
...@@ -918,7 +916,7 @@ template <typename _Tp, typename _Alloc> ...@@ -918,7 +916,7 @@ template <typename _Tp, typename _Alloc>
equal(__x.begin(), __x.end(), __y.begin()); equal(__x.begin(), __x.end(), __y.begin());
} }
/** /**
* @brief Vector ordering relation. * @brief Vector ordering relation.
* @param x A %vector. * @param x A %vector.
* @param y A %vector of the same type as @a x. * @param y A %vector of the same type as @a x.
...@@ -928,8 +926,8 @@ template <typename _Tp, typename _Alloc> ...@@ -928,8 +926,8 @@ template <typename _Tp, typename _Alloc>
* vectors. The elements must be comparable with @c <. * vectors. The elements must be comparable with @c <.
* *
* See std::lexographical_compare() for how the determination is made. * See std::lexographical_compare() for how the determination is made.
*/ */
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator<(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator<(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ {
...@@ -937,36 +935,35 @@ template <typename _Tp, typename _Alloc> ...@@ -937,36 +935,35 @@ template <typename _Tp, typename _Alloc>
__y.begin(), __y.end()); __y.begin(), __y.end());
} }
/// Based on operator== /// Based on operator==
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator!=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator!=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator>(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator>(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator<=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator<=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline bool inline bool
operator>=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y) operator>=(const vector<_Tp,_Alloc>& __x, const vector<_Tp,_Alloc>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
/// See std::vector::swap(). /// See std::vector::swap().
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
inline void inline void
swap(vector<_Tp,_Alloc>& __x, vector<_Tp,_Alloc>& __y) swap(vector<_Tp,_Alloc>& __x, vector<_Tp,_Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_VECTOR_H */ #endif /* __GLIBCPP_INTERNAL_VECTOR_H */
...@@ -61,13 +61,9 @@ ...@@ -61,13 +61,9 @@
#ifndef __GLIBCPP_INTERNAL_VECTOR_TCC #ifndef __GLIBCPP_INTERNAL_VECTOR_TCC
#define __GLIBCPP_INTERNAL_VECTOR_TCC #define __GLIBCPP_INTERNAL_VECTOR_TCC
// Since this entire file is within namespace std, there's no reason to
// waste two spaces along the left column. Thus the leading indentation is
// slightly violated from here on.
namespace std namespace std
{ {
template <typename _Tp, typename _Alloc>
template <typename _Tp, typename _Alloc>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
reserve(size_type __n) reserve(size_type __n)
...@@ -84,7 +80,7 @@ template <typename _Tp, typename _Alloc> ...@@ -84,7 +80,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename vector<_Tp,_Alloc>::iterator typename vector<_Tp,_Alloc>::iterator
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
...@@ -100,7 +96,7 @@ template <typename _Tp, typename _Alloc> ...@@ -100,7 +96,7 @@ template <typename _Tp, typename _Alloc>
return begin() + __n; return begin() + __n;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename vector<_Tp,_Alloc>::iterator typename vector<_Tp,_Alloc>::iterator
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
erase(iterator __position) erase(iterator __position)
...@@ -112,7 +108,7 @@ template <typename _Tp, typename _Alloc> ...@@ -112,7 +108,7 @@ template <typename _Tp, typename _Alloc>
return __position; return __position;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
typename vector<_Tp,_Alloc>::iterator typename vector<_Tp,_Alloc>::iterator
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
...@@ -123,7 +119,7 @@ template <typename _Tp, typename _Alloc> ...@@ -123,7 +119,7 @@ template <typename _Tp, typename _Alloc>
return __first; return __first;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
vector<_Tp,_Alloc>& vector<_Tp,_Alloc>&
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
operator=(const vector<_Tp,_Alloc>& __x) operator=(const vector<_Tp,_Alloc>& __x)
...@@ -154,7 +150,7 @@ template <typename _Tp, typename _Alloc> ...@@ -154,7 +150,7 @@ template <typename _Tp, typename _Alloc>
return *this; return *this;
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_fill_assign(size_t __n, const value_type& __val) _M_fill_assign(size_t __n, const value_type& __val)
...@@ -173,7 +169,7 @@ template <typename _Tp, typename _Alloc> ...@@ -173,7 +169,7 @@ template <typename _Tp, typename _Alloc>
erase(fill_n(begin(), __n, __val), end()); erase(fill_n(begin(), __n, __val), end());
} }
template <typename _Tp, typename _Alloc> template <typename _InputIter> template <typename _Tp, typename _Alloc> template <typename _InputIter>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_assign_aux(_InputIter __first, _InputIter __last, input_iterator_tag) _M_assign_aux(_InputIter __first, _InputIter __last, input_iterator_tag)
...@@ -187,10 +183,11 @@ template <typename _Tp, typename _Alloc> template <typename _InputIter> ...@@ -187,10 +183,11 @@ template <typename _Tp, typename _Alloc> template <typename _InputIter>
insert(end(), __first, __last); insert(end(), __first, __last);
} }
template <typename _Tp, typename _Alloc> template <typename _ForwardIter> template <typename _Tp, typename _Alloc> template <typename _ForwardIter>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_assign_aux(_ForwardIter __first, _ForwardIter __last, forward_iterator_tag) _M_assign_aux(_ForwardIter __first, _ForwardIter __last,
forward_iterator_tag)
{ {
size_type __len = distance(__first, __last); size_type __len = distance(__first, __last);
...@@ -217,7 +214,7 @@ template <typename _Tp, typename _Alloc> template <typename _ForwardIter> ...@@ -217,7 +214,7 @@ template <typename _Tp, typename _Alloc> template <typename _ForwardIter>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_insert_aux(iterator __position, const _Tp& __x) _M_insert_aux(iterator __position, const _Tp& __x)
...@@ -259,8 +256,8 @@ template <typename _Tp, typename _Alloc> ...@@ -259,8 +256,8 @@ template <typename _Tp, typename _Alloc>
} }
} }
#ifdef _GLIBCPP_DEPRECATED #ifdef _GLIBCPP_DEPRECATED
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_insert_aux(iterator __position) _M_insert_aux(iterator __position)
...@@ -301,9 +298,9 @@ template <typename _Tp, typename _Alloc> ...@@ -301,9 +298,9 @@ template <typename _Tp, typename _Alloc>
_M_end_of_storage = __new_start + __len; _M_end_of_storage = __new_start + __len;
} }
} }
#endif #endif
template <typename _Tp, typename _Alloc> template <typename _Tp, typename _Alloc>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_fill_insert(iterator __position, size_type __n, const value_type& __x) _M_fill_insert(iterator __position, size_type __n, const value_type& __x)
...@@ -338,7 +335,8 @@ template <typename _Tp, typename _Alloc> ...@@ -338,7 +335,8 @@ template <typename _Tp, typename _Alloc>
iterator __new_finish(__new_start); iterator __new_finish(__new_start);
try try
{ {
__new_finish = uninitialized_copy(begin(), __position, __new_start); __new_finish = uninitialized_copy(begin(), __position,
__new_start);
__new_finish = uninitialized_fill_n(__new_finish, __n, __x); __new_finish = uninitialized_fill_n(__new_finish, __n, __x);
__new_finish __new_finish
= uninitialized_copy(__position, end(), __new_finish); = uninitialized_copy(__position, end(), __new_finish);
...@@ -358,7 +356,7 @@ template <typename _Tp, typename _Alloc> ...@@ -358,7 +356,7 @@ template <typename _Tp, typename _Alloc>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _InputIterator> template <typename _Tp, typename _Alloc> template <typename _InputIterator>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_range_insert(iterator __pos, _M_range_insert(iterator __pos,
...@@ -372,7 +370,7 @@ template <typename _Tp, typename _Alloc> template <typename _InputIterator> ...@@ -372,7 +370,7 @@ template <typename _Tp, typename _Alloc> template <typename _InputIterator>
} }
} }
template <typename _Tp, typename _Alloc> template <typename _ForwardIterator> template <typename _Tp, typename _Alloc> template <typename _ForwardIterator>
void void
vector<_Tp,_Alloc>:: vector<_Tp,_Alloc>::
_M_range_insert(iterator __position, _M_range_insert(iterator __position,
...@@ -432,8 +430,6 @@ template <typename _Tp, typename _Alloc> template <typename _ForwardIterator> ...@@ -432,8 +430,6 @@ template <typename _Tp, typename _Alloc> template <typename _ForwardIterator>
} }
} }
} }
} // namespace std } // namespace std
#endif /* __GLIBCPP_INTERNAL_VECTOR_TCC */ #endif /* __GLIBCPP_INTERNAL_VECTOR_TCC */
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