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