+2017-03-20 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/stl_deque.h (deque): Access allocator value_type only if
+ concept checks are enabled.
+ * include/bits/stl_stack.h (stack): Likewise.
+ * include/bits/stl_vector.h (vector): Likewise.
+ * include/bits/stl_list.h (list): Likewise and check
+ _SGIAssignableConcept only in C++03.
+ * include/bits/stl_map.h (map): Likewise.
+ * include/bits/stl_set.h (set): Likewise.
+ * include/bits/stl_multimap.h (multimap): Likewise.
+ * include/bits/stl_multiset.h (multiset): Likewise.
+ * include/bits/stl_queue.h (queue, priority_queue): Likewise.
+
2017-03-18 Gerald Pfeifer <gerald@pfeifer.com>
* doc/xml/manual/appendix_contributing.xml: Convert link to
Tweak link description.
2017-02-18 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* doc/xml/manual/profile_mode.xml: Fix link.
2017-02-16 Gerald Pfeifer <gerald@pfeifer.com>
* include/bits/atomic_base.h: Re-indent.
-2017-02-10 Gerald Pfeifer <gerald@pfeifer.com>
+2017-02-10 Gerald Pfeifer <gerald@pfeifer.com>
- * doc/xml/manual/profile_mode.xml: Update a paper reference.
+ * doc/xml/manual/profile_mode.xml: Update a paper reference.
2017-02-08 Gerald Pfeifer <gerald@pfeifer.com>
* doc/html/*: Regenerate.
2017-02-08 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* doc/xml/manual/profile_mode.xml: Unbreak link to
"Optimizing Sorting with Machine Learning Algorithms".
2017-02-08 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* src/c++11/snprintf_lite.cc (__err): Update bug reporting URL.
2017-02-08 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* doc/xml/manual/abi.xml: Update link to "Sun Studio 11: C++
Migration Guide".
* doc/xml/manual/debug.xml: code.google.com uses https now.
2017-01-22 Gerald Pfeifer <gerald@pfeifer.com>
-
+
* doc/xml/manual/test.xml: Fix link into gccint online manual.
2017-01-21 Ville Voutilainen <ville.voutilainen@gmail.com>
2017-01-17 Joshua Conner <joshconner@google.com>
* crossconfig.m4: Add fuchsia OS.
- * configure: Regenerate.
+ * configure: Regenerate.
2017-01-17 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/faq.xml: Update address of C++ ABI link.
* doc/xml/manual/abi.xml: Ditto.
-
+
2017-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
struct _Deque_iterator
{
#if __cplusplus < 201103L
- typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
- typedef _Tp* _Elt_pointer;
- typedef _Tp** _Map_pointer;
+ typedef _Tp* _Elt_pointer;
+ typedef _Tp** _Map_pointer;
#else
private:
template<typename _Up>
static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
{ return __deque_buf_size(sizeof(_Tp)); }
- typedef std::random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Ptr pointer;
- typedef _Ref reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Deque_iterator _Self;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Ptr pointer;
+ typedef _Ref reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Deque_iterator _Self;
_Elt_pointer _M_cur;
_Elt_pointer _M_first;
_Deque_iterator(_Elt_pointer __x, _Map_pointer __y) _GLIBCXX_NOEXCEPT
: _M_cur(__x), _M_first(*__y),
- _M_last(*__y + _S_buffer_size()), _M_node(__y) { }
+ _M_last(*__y + _S_buffer_size()), _M_node(__y) { }
_Deque_iterator() _GLIBCXX_NOEXCEPT
: _M_cur(), _M_first(), _M_last(), _M_node() { }
_Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
: _M_cur(__x._M_cur), _M_first(__x._M_first),
- _M_last(__x._M_last), _M_node(__x._M_node) { }
+ _M_last(__x._M_last), _M_node(__x._M_node) { }
iterator
_M_const_cast() const _GLIBCXX_NOEXCEPT
{
const difference_type __node_offset =
__offset > 0 ? __offset / difference_type(_S_buffer_size())
- : -difference_type((-__offset - 1)
+ : -difference_type((-__offset - 1)
/ _S_buffer_size()) - 1;
_M_set_node(_M_node + __node_offset);
_M_cur = _M_first + (__offset - __node_offset
operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
{ return *(*this + __n); }
- /**
+ /**
* Prepares to traverse new_node. Sets everything except
* _M_cur, which should therefore be set by the caller
* immediately afterwards, based on _M_first and _M_last.
operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
- : (__x._M_node < __y._M_node); }
+ : (__x._M_node < __y._M_node); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
- : (__x._M_node < __y._M_node); }
+ : (__x._M_node < __y._M_node); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
typedef __gnu_cxx::__alloc_traits<_Map_alloc_type> _Map_alloc_traits;
public:
- typedef _Alloc allocator_type;
+ typedef _Alloc allocator_type;
typedef typename _Alloc_traits::size_type size_type;
allocator_type
get_allocator() const _GLIBCXX_NOEXCEPT
{ return allocator_type(_M_get_Tp_allocator()); }
- typedef _Deque_iterator<_Tp, _Tp&, _Ptr> iterator;
+ typedef _Deque_iterator<_Tp, _Tp&, _Ptr> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, _Ptr_const> const_iterator;
_Deque_base()
_Ptr
_M_allocate_node()
- {
+ {
typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Traits;
return _Traits::allocate(_M_impl, __deque_buf_size(sizeof(_Tp)));
}
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class deque : protected _Deque_base<_Tp, _Alloc>
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
-#if __cplusplus < 201103L
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
-#endif
+# endif
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
+#endif
typedef _Deque_base<_Tp, _Alloc> _Base;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
typedef typename _Base::_Map_pointer _Map_pointer;
public:
- typedef _Tp value_type;
- typedef typename _Alloc_traits::pointer pointer;
- typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
- typedef typename _Base::iterator iterator;
- typedef typename _Base::const_iterator const_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Alloc allocator_type;
+ typedef _Tp value_type;
+ typedef typename _Alloc_traits::pointer pointer;
+ typedef typename _Alloc_traits::const_pointer const_pointer;
+ typedef typename _Alloc_traits::reference reference;
+ typedef typename _Alloc_traits::const_reference const_reference;
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
protected:
static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
using _Base::_M_deallocate_map;
using _Base::_M_get_Tp_allocator;
- /**
+ /**
* A total of four data members accumulated down the hierarchy.
* May be accessed via _M_impl.*
*/
deque(const deque& __x)
: _Base(_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()),
__x.size())
- { std::__uninitialized_copy_a(__x.begin(), __x.end(),
+ { std::__uninitialized_copy_a(__x.begin(), __x.end(),
this->_M_impl._M_start,
_M_get_Tp_allocator()); }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- deque(_InputIterator __first, _InputIterator __last,
+ deque(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
- { _M_initialize_dispatch(__first, __last, __false_type()); }
+ { _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator>
- deque(_InputIterator __first, _InputIterator __last,
+ deque(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
- {
+ {
// Check whether it's an integral type. If so, it's not an iterator.
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- void
- assign(_InputIterator __first, _InputIterator __last)
- { _M_assign_dispatch(__first, __last, __false_type()); }
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ { _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator>
- void
- assign(_InputIterator __first, _InputIterator __last)
- {
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
{
_Alloc_traits::construct(this->_M_impl,
- this->_M_impl._M_start._M_cur - 1,
- __x);
+ this->_M_impl._M_start._M_cur - 1,
+ __x);
--this->_M_impl._M_start._M_cur;
}
else
#else
void
#endif
- emplace_front(_Args&&... __args);
+ emplace_front(_Args&&... __args);
#endif
/**
!= this->_M_impl._M_finish._M_last - 1)
{
_Alloc_traits::construct(this->_M_impl,
- this->_M_impl._M_finish._M_cur, __x);
+ this->_M_impl._M_finish._M_cur, __x);
++this->_M_impl._M_finish._M_cur;
}
else
#else
void
#endif
- emplace_back(_Args&&... __args);
+ emplace_back(_Args&&... __args);
#endif
/**
!= this->_M_impl._M_start._M_last - 1)
{
_Alloc_traits::destroy(this->_M_impl,
- this->_M_impl._M_start._M_cur);
+ this->_M_impl._M_start._M_cur);
++this->_M_impl._M_start._M_cur;
}
else
{
--this->_M_impl._M_finish._M_cur;
_Alloc_traits::destroy(this->_M_impl,
- this->_M_impl._M_finish._M_cur);
+ this->_M_impl._M_finish._M_cur);
}
else
_M_pop_back_aux();
* with T(std::forward<Args>(args)...) before the specified location.
*/
template<typename... _Args>
- iterator
- emplace(const_iterator __position, _Args&&... __args);
+ iterator
+ emplace(const_iterator __position, _Args&&... __args);
/**
* @brief Inserts given value into %deque before specified iterator.
*/
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- iterator
- insert(const_iterator __position, _InputIterator __first,
+ iterator
+ insert(const_iterator __position, _InputIterator __first,
_InputIterator __last)
- {
+ {
difference_type __offset = __position - cbegin();
_M_insert_dispatch(__position._M_const_cast(),
__first, __last, __false_type());
* by @a __position. This is known as <em>range insert</em>.
*/
template<typename _InputIterator>
- void
- insert(iterator __position, _InputIterator __first,
+ void
+ insert(iterator __position, _InputIterator __first,
_InputIterator __last)
- {
+ {
// Check whether it's an integral type. If so, it's not an iterator.
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral());
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
- void
- _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
- {
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ {
_M_initialize_map(static_cast<size_type>(__n));
_M_fill_initialize(__x);
}
// called by the range constructor to implement [23.1.1]/9
template<typename _InputIterator>
- void
- _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
__false_type)
- {
+ {
_M_range_initialize(__first, __last,
std::__iterator_category(__first));
}
* push_back on each value from the iterator.
*/
template<typename _InputIterator>
- void
- _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ void
+ _M_range_initialize(_InputIterator __first, _InputIterator __last,
std::input_iterator_tag);
// called by the second initialize_dispatch above
template<typename _ForwardIterator>
- void
- _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ void
+ _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
std::forward_iterator_tag);
//@}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
- void
- _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { _M_fill_assign(__n, __val); }
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
// called by the range assign to implement [23.1.1]/9
template<typename _InputIterator>
- void
- _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type)
{ _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
// called by the second assign_dispatch above
template<typename _InputIterator>
- void
- _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ void
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
std::input_iterator_tag);
// called by the second assign_dispatch above
template<typename _ForwardIterator>
- void
- _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ void
+ _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
std::forward_iterator_tag)
- {
+ {
const size_type __len = std::distance(__first, __last);
if (__len > size())
{
void _M_push_front_aux(const value_type&);
#else
template<typename... _Args>
- void _M_push_back_aux(_Args&&... __args);
+ void _M_push_back_aux(_Args&&... __args);
template<typename... _Args>
- void _M_push_front_aux(_Args&&... __args);
+ void _M_push_front_aux(_Args&&... __args);
#endif
void _M_pop_back_aux();
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
- void
- _M_insert_dispatch(iterator __pos,
+ void
+ _M_insert_dispatch(iterator __pos,
_Integer __n, _Integer __x, __true_type)
- { _M_fill_insert(__pos, __n, __x); }
+ { _M_fill_insert(__pos, __n, __x); }
// called by the range insert to implement [23.1.1]/9
template<typename _InputIterator>
- void
- _M_insert_dispatch(iterator __pos,
+ void
+ _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type)
- {
- _M_range_insert_aux(__pos, __first, __last,
+ {
+ _M_range_insert_aux(__pos, __first, __last,
std::__iterator_category(__first));
}
// called by the second insert_dispatch above
template<typename _InputIterator>
- void
- _M_range_insert_aux(iterator __pos, _InputIterator __first,
+ void
+ _M_range_insert_aux(iterator __pos, _InputIterator __first,
_InputIterator __last, std::input_iterator_tag);
// called by the second insert_dispatch above
template<typename _ForwardIterator>
- void
- _M_range_insert_aux(iterator __pos, _ForwardIterator __first,
+ void
+ _M_range_insert_aux(iterator __pos, _ForwardIterator __first,
_ForwardIterator __last, std::forward_iterator_tag);
// Called by insert(p,n,x), and the range insert when it turns out to be
_M_insert_aux(iterator __pos, const value_type& __x);
#else
template<typename... _Args>
- iterator
- _M_insert_aux(iterator __pos, _Args&&... __args);
+ iterator
+ _M_insert_aux(iterator __pos, _Args&&... __args);
#endif
// called by insert(p,n,x) via fill_insert
// called by range_insert_aux for forward iterators
template<typename _ForwardIterator>
- void
- _M_insert_aux(iterator __pos,
+ void
+ _M_insert_aux(iterator __pos,
_ForwardIterator __first, _ForwardIterator __last,
size_type __n);
// Called by ~deque().
// NB: Doesn't deallocate the nodes.
template<typename _Alloc1>
- void
- _M_destroy_data(iterator __first, iterator __last, const _Alloc1&)
- { _M_destroy_data_aux(__first, __last); }
+ void
+ _M_destroy_data(iterator __first, iterator __last, const _Alloc1&)
+ { _M_destroy_data_aux(__first, __last); }
void
_M_destroy_data(iterator __first, iterator __last,
_M_reserve_elements_at_front(size_type __n)
{
const size_type __vacancies = this->_M_impl._M_start._M_cur
- - this->_M_impl._M_start._M_first;
+ - this->_M_impl._M_start._M_first;
if (__n > __vacancies)
_M_new_elements_at_front(__n - __vacancies);
return this->_M_impl._M_start - difference_type(__n);
operator==(const deque<_Tp, _Alloc>& __x,
const deque<_Tp, _Alloc>& __y)
{ return __x.size() == __y.size()
- && std::equal(__x.begin(), __x.end(), __y.begin()); }
+ && std::equal(__x.begin(), __x.end(), __y.begin()); }
/**
* @brief Deque ordering relation.
// "needless" static_cast'ing later on, but it's all safe
// downcasting.
- /// Common part of a node in the %list.
+ /// Common part of a node in the %list.
struct _List_node_base
{
_List_node_base* _M_next;
template<typename _Tp>
struct _List_iterator
{
- typedef _List_iterator<_Tp> _Self;
- typedef _List_node<_Tp> _Node;
+ typedef _List_iterator<_Tp> _Self;
+ typedef _List_node<_Tp> _Node;
- typedef ptrdiff_t difference_type;
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
_List_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
template<typename _Tp>
struct _List_const_iterator
{
- typedef _List_const_iterator<_Tp> _Self;
- typedef const _List_node<_Tp> _Node;
- typedef _List_iterator<_Tp> iterator;
+ typedef _List_const_iterator<_Tp> _Self;
+ typedef const _List_node<_Tp> _Node;
+ typedef _List_iterator<_Tp> iterator;
- typedef ptrdiff_t difference_type;
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
_List_const_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
template<typename _Val>
inline bool
operator!=(const _List_iterator<_Val>& __x,
- const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
+ const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
_GLIBCXX_BEGIN_NAMESPACE_CXX11
void
_M_init() _GLIBCXX_NOEXCEPT
{
- this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
- this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
+ this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
+ this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
_M_set_size(0);
}
};
* pointing to @e D, not to @e A! To get to the head of the %list,
* we start at the tail and move forward by one. When this member
* iterator's next/previous pointers refer to itself, the %list is
- * %empty.
+ * %empty.
*/
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class list : protected _List_base<_Tp, _Alloc>
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
+#endif
- typedef _List_base<_Tp, _Alloc> _Base;
- typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
- typedef typename _Base::_Tp_alloc_traits _Tp_alloc_traits;
- typedef typename _Base::_Node_alloc_type _Node_alloc_type;
- typedef typename _Base::_Node_alloc_traits _Node_alloc_traits;
+ typedef _List_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ typedef typename _Base::_Tp_alloc_traits _Tp_alloc_traits;
+ typedef typename _Base::_Node_alloc_type _Node_alloc_type;
+ typedef typename _Base::_Node_alloc_traits _Node_alloc_traits;
public:
- typedef _Tp value_type;
+ typedef _Tp value_type;
typedef typename _Tp_alloc_traits::pointer pointer;
typedef typename _Tp_alloc_traits::const_pointer const_pointer;
typedef typename _Tp_alloc_traits::reference reference;
typedef typename _Tp_alloc_traits::const_reference const_reference;
typedef _List_iterator<_Tp> iterator;
typedef _List_const_iterator<_Tp> const_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Alloc allocator_type;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
protected:
// Note that pointers-to-_Node's can be ctor-converted to
}
#else
template<typename... _Args>
- _Node*
- _M_create_node(_Args&&... __args)
+ _Node*
+ _M_create_node(_Args&&... __args)
{
auto __p = this->_M_get_node();
auto& __alloc = _M_get_Node_allocator();
* initializer_list @a __l. This is linear in __l.size().
*/
list(initializer_list<value_type> __l,
- const allocator_type& __a = allocator_type())
+ const allocator_type& __a = allocator_type())
: _Base(_Node_alloc_type(__a))
{ _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- list(_InputIterator __first, _InputIterator __last,
+ list(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(_Node_alloc_type(__a))
- { _M_initialize_dispatch(__first, __last, __false_type()); }
+ { _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator>
- list(_InputIterator __first, _InputIterator __last,
+ list(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(_Node_alloc_type(__a))
- {
+ {
// Check whether it's an integral type. If so, it's not an iterator.
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
noexcept(_Node_alloc_traits::_S_nothrow_move())
{
constexpr bool __move_storage =
- _Node_alloc_traits::_S_propagate_on_move_assign()
- || _Node_alloc_traits::_S_always_equal();
- _M_move_assign(std::move(__x), __bool_constant<__move_storage>());
+ _Node_alloc_traits::_S_propagate_on_move_assign()
+ || _Node_alloc_traits::_S_always_equal();
+ _M_move_assign(std::move(__x), __bool_constant<__move_storage>());
return *this;
}
#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- void
- assign(_InputIterator __first, _InputIterator __last)
- { _M_assign_dispatch(__first, __last, __false_type()); }
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ { _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator>
- void
- assign(_InputIterator __first, _InputIterator __last)
- {
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
// Check whether it's an integral type. If so, it's not an iterator.
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral());
*/
reference
back() _GLIBCXX_NOEXCEPT
- {
+ {
iterator __tmp = end();
--__tmp;
return *__tmp;
*/
const_reference
back() const _GLIBCXX_NOEXCEPT
- {
+ {
const_iterator __tmp = end();
--__tmp;
return *__tmp;
template<typename... _Args>
#if __cplusplus > 201402L
- reference
+ reference
#else
void
#endif
- emplace_front(_Args&&... __args)
- {
+ emplace_front(_Args&&... __args)
+ {
this->_M_insert(begin(), std::forward<_Args>(__args)...);
#if __cplusplus > 201402L
return front();
template<typename... _Args>
#if __cplusplus > 201402L
- reference
+ reference
#else
void
#endif
- emplace_back(_Args&&... __args)
- {
+ emplace_back(_Args&&... __args)
+ {
this->_M_insert(end(), std::forward<_Args>(__args)...);
#if __cplusplus > 201402L
- return back();
+ return back();
#endif
}
#endif
* and references.
*/
template<typename... _Args>
- iterator
- emplace(const_iterator __position, _Args&&... __args);
+ iterator
+ emplace(const_iterator __position, _Args&&... __args);
/**
* @brief Inserts given value into %list before specified iterator.
* the specified location. Due to the nature of a %list this
* operation can be done in constant time, and does not
* invalidate iterators and references.
- */
+ */
iterator
insert(const_iterator __position, value_type&& __x)
{ return emplace(__position, std::move(__x)); }
* does not invalidate iterators and references.
*/
template<typename _InputIterator>
- void
- insert(iterator __position, _InputIterator __first,
+ void
+ insert(iterator __position, _InputIterator __first,
_InputIterator __last)
- {
+ {
list __tmp(__first, __last, get_allocator());
splice(__position, __tmp);
}
swap(list& __x) _GLIBCXX_NOEXCEPT
{
__detail::_List_node_base::swap(this->_M_impl._M_node,
- __x._M_impl._M_node);
+ __x._M_impl._M_node);
size_t __xsize = __x._M_get_size();
__x._M_set_size(this->_M_get_size());
this->_M_set_size(__xsize);
_Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(),
- __x._M_get_Node_allocator());
+ __x._M_get_Node_allocator());
}
/**
void
clear() _GLIBCXX_NOEXCEPT
{
- _Base::_M_clear();
- _Base::_M_init();
+ _Base::_M_clear();
+ _Base::_M_init();
}
// [23.2.2.4] list operations
* responsibility.
*/
template<typename _Predicate>
- void
- remove_if(_Predicate);
+ void
+ remove_if(_Predicate);
/**
* @brief Remove consecutive duplicate elements.
* Managing the pointer is the user's responsibility.
*/
template<typename _BinaryPredicate>
- void
- unique(_BinaryPredicate);
+ void
+ unique(_BinaryPredicate);
/**
* @brief Merge sorted lists.
*/
#if __cplusplus >= 201103L
template<typename _StrictWeakOrdering>
- void
- merge(list&& __x, _StrictWeakOrdering __comp);
+ void
+ merge(list&& __x, _StrictWeakOrdering __comp);
template<typename _StrictWeakOrdering>
- void
- merge(list& __x, _StrictWeakOrdering __comp)
- { merge(std::move(__x), __comp); }
+ void
+ merge(list& __x, _StrictWeakOrdering __comp)
+ { merge(std::move(__x), __comp); }
#else
template<typename _StrictWeakOrdering>
- void
- merge(list& __x, _StrictWeakOrdering __comp);
+ void
+ merge(list& __x, _StrictWeakOrdering __comp);
#endif
/**
* elements remain in list order.
*/
template<typename _StrictWeakOrdering>
- void
- sort(_StrictWeakOrdering);
+ void
+ sort(_StrictWeakOrdering);
protected:
// Internal constructor functions follow.
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
- void
- _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
- { _M_fill_initialize(static_cast<size_type>(__n), __x); }
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ { _M_fill_initialize(static_cast<size_type>(__n), __x); }
// Called by the range constructor to implement [23.1.1]/9
template<typename _InputIterator>
- void
- _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
__false_type)
- {
+ {
for (; __first != __last; ++__first)
#if __cplusplus >= 201103L
emplace_back(*__first);
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 438. Ambiguity in the "do the right thing" clause
template<typename _Integer>
- void
- _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { _M_fill_assign(__n, __val); }
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
// Called by the range assign to implement [23.1.1]/9
template<typename _InputIterator>
- void
- _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type);
// Called by assign(n,t), and the range assign when it turns out
void
_M_insert(iterator __position, const value_type& __x)
{
- _Node* __tmp = _M_create_node(__x);
- __tmp->_M_hook(__position._M_node);
+ _Node* __tmp = _M_create_node(__x);
+ __tmp->_M_hook(__position._M_node);
this->_M_inc_size(1);
}
#else
_M_erase(iterator __position) _GLIBCXX_NOEXCEPT
{
this->_M_dec_size(1);
- __position._M_node->_M_unhook();
- _Node* __n = static_cast<_Node*>(__position._M_node);
+ __position._M_node->_M_unhook();
+ _Node* __n = static_cast<_Node*>(__position._M_node);
#if __cplusplus >= 201103L
_Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr());
#else
_Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr());
#endif
- _M_put_node(__n);
+ _M_put_node(__n);
}
// To implement the splice (and merge) bits of N1599.
this->_M_set_size(__x._M_get_size());
__x._M_init();
}
- std::__alloc_on_move(this->_M_get_Node_allocator(),
- __x._M_get_Node_allocator());
+ std::__alloc_on_move(this->_M_get_Node_allocator(),
+ __x._M_get_Node_allocator());
}
void
_M_move_assign(list&& __x, false_type)
{
if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator())
- _M_move_assign(std::move(__x), true_type{});
- else
+ _M_move_assign(std::move(__x), true_type{});
+ else
// The rvalue's allocator cannot be moved, or is not equal,
// so we need to individually move each element.
_M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()),
* @tparam _Key Type of key objects.
* @tparam _Tp Type of mapped objects.
* @tparam _Compare Comparison function object type, defaults to less<_Key>.
- * @tparam _Alloc Allocator type, defaults to
+ * @tparam _Alloc Allocator type, defaults to
* allocator<pair<const _Key, _Tp>.
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* called (*_unique versus *_equal, same as the standard).
*/
template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
- typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
class map
{
public:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef std::pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
- typedef _Alloc allocator_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Alloc allocator_type;
private:
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires4(_Compare, bool, _Key, _Key,
_BinaryFunctionConcept)
__glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
+#endif
public:
class value_compare
};
private:
- /// This turns a red-black tree into a [multi]map.
+ /// This turns a red-black tree into a [multi]map.
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
rebind<value_type>::other _Pair_alloc_type;
public:
// many of these are specified differently in ISO, but the following are
// "functionally equivalent"
- typedef typename _Alloc_traits::pointer pointer;
- typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Alloc_traits::pointer pointer;
+ typedef typename _Alloc_traits::const_pointer const_pointer;
+ typedef typename _Alloc_traits::reference reference;
+ typedef typename _Alloc_traits::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
#if __cplusplus > 201402L
/// Allocator-extended range constructor.
template<typename _InputIterator>
- map(_InputIterator __first, _InputIterator __last,
+ map(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: _M_t(_Compare(), _Pair_alloc_type(__a))
- { _M_t._M_insert_unique(__first, __last); }
+ { _M_t._M_insert_unique(__first, __last); }
#endif
/**
* distance(__first,__last)).
*/
template<typename _InputIterator>
- map(_InputIterator __first, _InputIterator __last)
+ map(_InputIterator __first, _InputIterator __last)
: _M_t()
- { _M_t._M_insert_unique(__first, __last); }
+ { _M_t._M_insert_unique(__first, __last); }
/**
* @brief Builds a %map from a range.
* distance(__first,__last)).
*/
template<typename _InputIterator>
- map(_InputIterator __first, _InputIterator __last,
+ map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, _Pair_alloc_type(__a))
- { _M_t._M_insert_unique(__first, __last); }
+ { _M_t._M_insert_unique(__first, __last); }
#if __cplusplus >= 201103L
/**
std::tuple<const key_type&>(__k),
std::tuple<>());
#else
- __i = insert(__i, value_type(__k, mapped_type()));
+ __i = insert(__i, value_type(__k, mapped_type()));
#endif
return (*__i).second;
}
*
* @param __k Key to use for finding a possibly existing pair in
* the map.
- * @param __args Arguments used to generate the .second for a new pair
+ * @param __args Arguments used to generate the .second for a new pair
* instance.
*
* @return A pair, of which the first element is an iterator that points
* Insertion requires logarithmic time.
*/
template <typename... _Args>
- pair<iterator, bool>
- try_emplace(const key_type& __k, _Args&&... __args)
- {
- iterator __i = lower_bound(__k);
- if (__i == end() || key_comp()(__k, (*__i).first))
- {
- __i = emplace_hint(__i, std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(
- std::forward<_Args>(__args)...));
- return {__i, true};
- }
- return {__i, false};
- }
+ pair<iterator, bool>
+ try_emplace(const key_type& __k, _Args&&... __args)
+ {
+ iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ {
+ __i = emplace_hint(__i, std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(
+ std::forward<_Args>(__args)...));
+ return {__i, true};
+ }
+ return {__i, false};
+ }
// move-capable overload
template <typename... _Args>
- pair<iterator, bool>
- try_emplace(key_type&& __k, _Args&&... __args)
- {
- iterator __i = lower_bound(__k);
- if (__i == end() || key_comp()(__k, (*__i).first))
- {
- __i = emplace_hint(__i, std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(
- std::forward<_Args>(__args)...));
- return {__i, true};
- }
- return {__i, false};
- }
+ pair<iterator, bool>
+ try_emplace(key_type&& __k, _Args&&... __args)
+ {
+ iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ {
+ __i = emplace_hint(__i, std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(
+ std::forward<_Args>(__args)...));
+ return {__i, true};
+ }
+ return {__i, false};
+ }
/**
* @brief Attempts to build and insert a std::pair into the %map.
* pair should be inserted.
* @param __k Key to use for finding a possibly existing pair in
* the map.
- * @param __args Arguments used to generate the .second for a new pair
+ * @param __args Arguments used to generate the .second for a new pair
* instance.
* @return An iterator that points to the element with key of the
* std::pair built from @a __args (may or may not be that
* std::pair).
*
* This function is not concerned about whether the insertion took place,
- * and thus does not return a boolean like the single-argument
+ * and thus does not return a boolean like the single-argument
* try_emplace() does. However, if insertion did not take place,
* this function has no effect.
* Note that the first parameter is only a hint and can potentially
* Insertion requires logarithmic time (if the hint is not taken).
*/
template <typename... _Args>
- iterator
- try_emplace(const_iterator __hint, const key_type& __k,
- _Args&&... __args)
- {
- iterator __i;
- auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
- if (__true_hint.second)
- __i = emplace_hint(iterator(__true_hint.second),
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(
- std::forward<_Args>(__args)...));
- else
- __i = iterator(__true_hint.first);
- return __i;
- }
+ iterator
+ try_emplace(const_iterator __hint, const key_type& __k,
+ _Args&&... __args)
+ {
+ iterator __i;
+ auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
+ if (__true_hint.second)
+ __i = emplace_hint(iterator(__true_hint.second),
+ std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(
+ std::forward<_Args>(__args)...));
+ else
+ __i = iterator(__true_hint.first);
+ return __i;
+ }
// move-capable overload
template <typename... _Args>
- iterator
- try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
- {
- iterator __i;
- auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
- if (__true_hint.second)
- __i = emplace_hint(iterator(__true_hint.second),
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(
- std::forward<_Args>(__args)...));
- else
- __i = iterator(__true_hint.first);
- return __i;
- }
+ iterator
+ try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
+ {
+ iterator __i;
+ auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
+ if (__true_hint.second)
+ __i = emplace_hint(iterator(__true_hint.second),
+ std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(
+ std::forward<_Args>(__args)...));
+ else
+ __i = iterator(__true_hint.first);
+ return __i;
+ }
#endif
/**
* @param __x Pair to be inserted (see std::make_pair for easy
* creation of pairs).
*
- * @return A pair, of which the first element is an iterator that
- * points to the possibly inserted pair, and the second is
+ * @return A pair, of which the first element is an iterator that
+ * points 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.
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
- std::pair<iterator, bool>
- insert(_Pair&& __x)
- { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
+ std::pair<iterator, bool>
+ insert(_Pair&& __x)
+ { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
#endif
#if __cplusplus >= 201103L
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
- iterator
- insert(const_iterator __position, _Pair&& __x)
- { return _M_t._M_insert_unique_(__position,
+ iterator
+ insert(const_iterator __position, _Pair&& __x)
+ { return _M_t._M_insert_unique_(__position,
std::forward<_Pair>(__x)); }
#endif
* Complexity similar to that of the range constructor.
*/
template<typename _InputIterator>
- void
- insert(_InputIterator __first, _InputIterator __last)
- { _M_t._M_insert_unique(__first, __last); }
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_unique(__first, __last); }
#if __cplusplus > 201402L
#define __cpp_lib_map_insertion 201411
* @brief Attempts to insert or assign a std::pair into the %map.
* @param __k Key to use for finding a possibly existing pair in
* the map.
- * @param __obj Argument used to generate the .second for a pair
+ * @param __obj Argument used to generate the .second for a pair
* instance.
*
- * @return A pair, of which the first element is an iterator that
- * points to the possibly inserted pair, and the second is
+ * @return A pair, of which the first element is an iterator that
+ * points 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.
* Insertion requires logarithmic time.
*/
template <typename _Obj>
- pair<iterator, bool>
- insert_or_assign(const key_type& __k, _Obj&& __obj)
- {
- iterator __i = lower_bound(__k);
- if (__i == end() || key_comp()(__k, (*__i).first))
- {
- __i = emplace_hint(__i, std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(
- std::forward<_Obj>(__obj)));
- return {__i, true};
- }
- (*__i).second = std::forward<_Obj>(__obj);
- return {__i, false};
- }
+ pair<iterator, bool>
+ insert_or_assign(const key_type& __k, _Obj&& __obj)
+ {
+ iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ {
+ __i = emplace_hint(__i, std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(
+ std::forward<_Obj>(__obj)));
+ return {__i, true};
+ }
+ (*__i).second = std::forward<_Obj>(__obj);
+ return {__i, false};
+ }
// move-capable overload
template <typename _Obj>
- pair<iterator, bool>
- insert_or_assign(key_type&& __k, _Obj&& __obj)
- {
- iterator __i = lower_bound(__k);
- if (__i == end() || key_comp()(__k, (*__i).first))
- {
- __i = emplace_hint(__i, std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(
- std::forward<_Obj>(__obj)));
- return {__i, true};
- }
- (*__i).second = std::forward<_Obj>(__obj);
- return {__i, false};
- }
+ pair<iterator, bool>
+ insert_or_assign(key_type&& __k, _Obj&& __obj)
+ {
+ iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ {
+ __i = emplace_hint(__i, std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(
+ std::forward<_Obj>(__obj)));
+ return {__i, true};
+ }
+ (*__i).second = std::forward<_Obj>(__obj);
+ return {__i, false};
+ }
/**
* @brief Attempts to insert or assign a std::pair into the %map.
* pair should be inserted.
* @param __k Key to use for finding a possibly existing pair in
* the map.
- * @param __obj Argument used to generate the .second for a pair
+ * @param __obj Argument used to generate the .second for a pair
* instance.
*
* @return An iterator that points to the element with key of
* Insertion requires logarithmic time.
*/
template <typename _Obj>
- iterator
- insert_or_assign(const_iterator __hint,
- const key_type& __k, _Obj&& __obj)
- {
- iterator __i;
- auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
- if (__true_hint.second)
- {
- return emplace_hint(iterator(__true_hint.second),
- std::piecewise_construct,
- std::forward_as_tuple(__k),
- std::forward_as_tuple(
- std::forward<_Obj>(__obj)));
- }
- __i = iterator(__true_hint.first);
- (*__i).second = std::forward<_Obj>(__obj);
- return __i;
- }
+ iterator
+ insert_or_assign(const_iterator __hint,
+ const key_type& __k, _Obj&& __obj)
+ {
+ iterator __i;
+ auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
+ if (__true_hint.second)
+ {
+ return emplace_hint(iterator(__true_hint.second),
+ std::piecewise_construct,
+ std::forward_as_tuple(__k),
+ std::forward_as_tuple(
+ std::forward<_Obj>(__obj)));
+ }
+ __i = iterator(__true_hint.first);
+ (*__i).second = std::forward<_Obj>(__obj);
+ return __i;
+ }
// move-capable overload
template <typename _Obj>
- iterator
- insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj)
- {
- iterator __i;
- auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
- if (__true_hint.second)
- {
- return emplace_hint(iterator(__true_hint.second),
- std::piecewise_construct,
- std::forward_as_tuple(std::move(__k)),
- std::forward_as_tuple(
- std::forward<_Obj>(__obj)));
- }
- __i = iterator(__true_hint.first);
- (*__i).second = std::forward<_Obj>(__obj);
- return __i;
- }
+ iterator
+ insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj)
+ {
+ iterator __i;
+ auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
+ if (__true_hint.second)
+ {
+ return emplace_hint(iterator(__true_hint.second),
+ std::piecewise_construct,
+ std::forward_as_tuple(std::move(__k)),
+ std::forward_as_tuple(
+ std::forward<_Obj>(__obj)));
+ }
+ __i = iterator(__true_hint.first);
+ (*__i).second = std::forward<_Obj>(__obj);
+ return __i;
+ }
#endif
#if __cplusplus >= 201103L
* @brief Erases an element from a %map.
* @param __position An iterator pointing to the element to be erased.
* @return An iterator pointing to the element immediately following
- * @a position prior to the element being erased. If no such
+ * @a position prior to the element being erased. If no such
* element exists, end() is returned.
*
* This function erases an element, pointed to by the given
//@}
template<typename _K1, typename _T1, typename _C1, typename _A1>
- friend bool
- operator==(const map<_K1, _T1, _C1, _A1>&,
+ friend bool
+ operator==(const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
template<typename _K1, typename _T1, typename _C1, typename _A1>
- friend bool
- operator<(const map<_K1, _T1, _C1, _A1>&,
+ friend bool
+ operator<(const map<_K1, _T1, _C1, _A1>&,
const map<_K1, _T1, _C1, _A1>&);
};
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)
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
{ return __x._M_t == __y._M_t; }
/**
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)
+ 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>
inline bool
operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
- const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__x == __y); }
/// 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)
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
{ return __y < __x; }
/// 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)
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__y < __x); }
/// 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)
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__x < __y); }
/// See std::map::swap().
* @tparam _Key Type of key objects.
* @tparam _Tp Type of mapped objects.
* @tparam _Compare Comparison function object type, defaults to less<_Key>.
- * @tparam _Alloc Allocator type, defaults to
+ * @tparam _Alloc Allocator type, defaults to
* allocator<pair<const _Key, _Tp>.
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
class multimap
{
public:
- typedef _Key key_type;
- typedef _Tp mapped_type;
- typedef std::pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
- typedef _Alloc allocator_type;
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Alloc allocator_type;
private:
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires4(_Compare, bool, _Key, _Key,
_BinaryFunctionConcept)
__glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
+#endif
public:
class value_compare
public:
// many of these are specified differently in ISO, but the following are
// "functionally equivalent"
- typedef typename _Alloc_traits::pointer pointer;
- typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Alloc_traits::pointer pointer;
+ typedef typename _Alloc_traits::const_pointer const_pointer;
+ typedef typename _Alloc_traits::reference reference;
+ typedef typename _Alloc_traits::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
#if __cplusplus > 201402L
/// Allocator-extended range constructor.
template<typename _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last,
+ multimap(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: _M_t(_Compare(), _Pair_alloc_type(__a))
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
#endif
/**
* and NlogN otherwise (where N is distance(__first,__last)).
*/
template<typename _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last)
+ multimap(_InputIterator __first, _InputIterator __last)
: _M_t()
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
/**
* @brief Builds a %multimap from a range.
* and NlogN otherwise (where N is distance(__first,__last)).
*/
template<typename _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last,
+ multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, _Pair_alloc_type(__a))
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
#if __cplusplus >= 201103L
/**
/// Get a copy of the memory allocation object.
allocator_type
- get_allocator() const _GLIBCXX_NOEXCEPT
+ get_allocator() const _GLIBCXX_NOEXCEPT
{ return allocator_type(_M_t.get_allocator()); }
// iterators
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
- iterator
- insert(_Pair&& __x)
- { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
+ iterator
+ insert(_Pair&& __x)
+ { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
#endif
/**
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
- iterator
- insert(const_iterator __position, _Pair&& __x)
- { return _M_t._M_insert_equal_(__position,
+ iterator
+ insert(const_iterator __position, _Pair&& __x)
+ { return _M_t._M_insert_equal_(__position,
std::forward<_Pair>(__x)); }
#endif
* Complexity similar to that of the range constructor.
*/
template<typename _InputIterator>
- void
- insert(_InputIterator __first, _InputIterator __last)
- { _M_t._M_insert_equal(__first, __last); }
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_equal(__first, __last); }
#if __cplusplus >= 201103L
/**
* @brief Erases an element from a %multimap.
* @param __position An iterator pointing to the element to be erased.
* @return An iterator pointing to the element immediately following
- * @a position prior to the element being erased. If no such
+ * @a position prior to the element being erased. If no such
* element exists, end() is returned.
*
* This function erases an element, pointed to by the given iterator,
//@}
template<typename _K1, typename _T1, typename _C1, typename _A1>
- friend bool
- operator==(const multimap<_K1, _T1, _C1, _A1>&,
+ friend bool
+ operator==(const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
template<typename _K1, typename _T1, typename _C1, typename _A1>
- friend bool
- operator<(const multimap<_K1, _T1, _C1, _A1>&,
+ friend bool
+ operator<(const multimap<_K1, _T1, _C1, _A1>&,
const multimap<_K1, _T1, _C1, _A1>&);
};
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)
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ return __x._M_t == __y._M_t; }
/**
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)
+ 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>
inline bool
operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
- const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__x == __y); }
/// 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)
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ return __y < __x; }
/// 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)
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__y < __x); }
/// 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)
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
{ return !(__x < __y); }
/// 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)
+ multimap<_Key, _Tp, _Compare, _Alloc>& __y)
_GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
typename _Alloc = std::allocator<_Key> >
class multiset
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires4(_Compare, bool, _Key, _Key,
_BinaryFunctionConcept)
- __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
+ __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
+#endif
public:
// typedefs:
typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits;
public:
- typedef typename _Alloc_traits::pointer pointer;
- typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
+ typedef typename _Alloc_traits::pointer pointer;
+ typedef typename _Alloc_traits::const_pointer const_pointer;
+ typedef typename _Alloc_traits::reference reference;
+ typedef typename _Alloc_traits::const_reference const_reference;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 103. set::iterator is required to be modifiable,
// but this allows modification of keys.
- typedef typename _Rep_type::const_iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
#if __cplusplus > 201402L
using node_type = typename _Rep_type::node_type;
* and NlogN otherwise (where N is distance(__first,__last)).
*/
template<typename _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last)
+ multiset(_InputIterator __first, _InputIterator __last)
: _M_t()
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
/**
* @brief Builds a %multiset from a range.
* and NlogN otherwise (where N is distance(__first,__last)).
*/
template<typename _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
+ multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, _Key_alloc_type(__a))
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
/**
* @brief %Multiset copy constructor.
/// Allocator-extended range constructor.
template<typename _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
+ multiset(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: _M_t(_Compare(), _Key_alloc_type(__a))
- { _M_t._M_insert_equal(__first, __last); }
+ { _M_t._M_insert_equal(__first, __last); }
/**
* The dtor only erases the elements, and note that if the elements
* Complexity similar to that of the range constructor.
*/
template<typename _InputIterator>
- void
- insert(_InputIterator __first, _InputIterator __last)
- { _M_t._M_insert_equal(__first, __last); }
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_equal(__first, __last); }
#if __cplusplus >= 201103L
/**
* @brief Erases an element from a %multiset.
* @param __position An iterator pointing to the element to be erased.
* @return An iterator pointing to the element immediately following
- * @a position prior to the element being erased. If no such
+ * @a position prior to the element being erased. If no such
* element exists, end() is returned.
*
* This function erases an element, pointed to by the given iterator,
//@}
template<typename _K1, typename _C1, typename _A1>
- friend bool
- operator==(const multiset<_K1, _C1, _A1>&,
+ friend bool
+ operator==(const multiset<_K1, _C1, _A1>&,
const multiset<_K1, _C1, _A1>&);
template<typename _K1, typename _C1, typename _A1>
- friend bool
- operator< (const multiset<_K1, _C1, _A1>&,
+ friend bool
+ operator< (const multiset<_K1, _C1, _A1>&,
const multiset<_K1, _C1, _A1>&);
};
template<typename _Tp, typename _Sequence = deque<_Tp> >
class queue
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
typedef typename _Sequence::value_type _Sequence_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
__glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
__glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
+#endif
template<typename _Tp1, typename _Seq1>
- friend bool
- operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
+ friend bool
+ operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
template<typename _Tp1, typename _Seq1>
- friend bool
- operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
+ friend bool
+ operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
#if __cplusplus >= 201103L
template<typename _Alloc>
#endif
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;
+ 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:
/* Maintainers wondering why this isn't uglified as per style
{ return c.emplace_back(std::forward<_Args>(__args)...); }
#else
template<typename... _Args>
- void
- emplace(_Args&&... __args)
+ void
+ emplace(_Args&&... __args)
{ c.emplace_back(std::forward<_Args>(__args)...); }
#endif
#endif
*
* @tparam _Tp Type of element.
* @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>.
- * @tparam _Compare Comparison function object type, defaults to
+ * @tparam _Compare Comparison function object type, defaults to
* less<_Sequence::value_type>.
*
* This is not a true container, but an @e adaptor. It holds
* another container, and provides a wrapper interface to that
- * container. The wrapper is what enforces priority-based sorting
+ * container. The wrapper is what enforces priority-based sorting
* and %queue behavior. Very few of the standard container/sequence
* interface requirements are met (e.g., iterators).
*
typename _Compare = less<typename _Sequence::value_type> >
class priority_queue
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
typedef typename _Sequence::value_type _Sequence_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires(_Sequence, _SequenceConcept)
__glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
__glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
__glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
_BinaryFunctionConcept)
+#endif
#if __cplusplus >= 201103L
template<typename _Alloc>
#endif
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;
+ 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;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 2684. priority_queue lacking comparator typedef
typedef _Compare value_compare;
#else
template<typename _Seq = _Sequence, typename _Requires = typename
enable_if<__and_<is_default_constructible<_Compare>,
- is_default_constructible<_Seq>>::value>::type>
+ is_default_constructible<_Seq>>::value>::type>
priority_queue()
: c(), comp() { }
*/
#if __cplusplus < 201103L
template<typename _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last,
+ priority_queue(_InputIterator __first, _InputIterator __last,
const _Compare& __x = _Compare(),
const _Sequence& __s = _Sequence())
: c(__s), comp(__x)
- {
+ {
__glibcxx_requires_valid_range(__first, __last);
c.insert(c.end(), __first, __last);
std::make_heap(c.begin(), c.end(), comp);
}
#else
template<typename _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last,
+ priority_queue(_InputIterator __first, _InputIterator __last,
const _Compare& __x,
const _Sequence& __s)
: c(__s), comp(__x)
- {
+ {
__glibcxx_requires_valid_range(__first, __last);
c.insert(c.end(), __first, __last);
std::make_heap(c.begin(), c.end(), comp);
}
template<typename _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last,
+ priority_queue(_InputIterator __first, _InputIterator __last,
const _Compare& __x = _Compare(),
_Sequence&& __s = _Sequence())
: c(std::move(__s)), comp(__x)
- {
+ {
__glibcxx_requires_valid_range(__first, __last);
c.insert(c.end(), __first, __last);
std::make_heap(c.begin(), c.end(), comp);
}
template<typename... _Args>
- void
- emplace(_Args&&... __args)
+ void
+ emplace(_Args&&... __args)
{
c.emplace_back(std::forward<_Args>(__args)...);
std::push_heap(c.begin(), c.end(), comp);
swap(priority_queue& __pq)
noexcept(__and_<
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
- __is_nothrow_swappable<_Sequence>,
+ __is_nothrow_swappable<_Sequence>,
#else
- __is_nothrow_swappable<_Tp>,
+ __is_nothrow_swappable<_Tp>,
#endif
- __is_nothrow_swappable<_Compare>
- >::value)
+ __is_nothrow_swappable<_Compare>
+ >::value)
{
using std::swap;
swap(c, __pq.c);
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
// Constrained free swap overload, see p0185r1
typename enable_if<__and_<__is_swappable<_Sequence>,
- __is_swappable<_Compare>>::value>::type
+ __is_swappable<_Compare>>::value>::type
#else
void
#endif
typename _Alloc = std::allocator<_Key> >
class set
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
- typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef typename _Alloc::value_type _Alloc_value_type;
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Key, _SGIAssignableConcept)
+# endif
__glibcxx_class_requires4(_Compare, bool, _Key, _Key,
_BinaryFunctionConcept)
__glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
+#endif
public:
// typedefs:
public:
//@{
/// Iterator-related typedefs.
- typedef typename _Alloc_traits::pointer pointer;
- typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
+ typedef typename _Alloc_traits::pointer pointer;
+ typedef typename _Alloc_traits::const_pointer const_pointer;
+ typedef typename _Alloc_traits::reference reference;
+ typedef typename _Alloc_traits::const_reference const_reference;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 103. set::iterator is required to be modifiable,
// but this allows modification of keys.
- typedef typename _Rep_type::const_iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
//@}
#if __cplusplus > 201402L
const _Compare& __comp,
const allocator_type& __a = allocator_type())
: _M_t(__comp, _Key_alloc_type(__a))
- { _M_t._M_insert_unique(__first, __last); }
+ { _M_t._M_insert_unique(__first, __last); }
/**
* @brief %Set copy constructor.
/// Allocator-extended range constructor.
template<typename _InputIterator>
- set(_InputIterator __first, _InputIterator __last,
+ set(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: _M_t(_Compare(), _Key_alloc_type(__a))
- { _M_t._M_insert_unique(__first, __last); }
+ { _M_t._M_insert_unique(__first, __last); }
/**
* The dtor only erases the elements, and note that if the elements
template<typename _Tp, typename _Sequence = deque<_Tp> >
class stack
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
typedef typename _Sequence::value_type _Sequence_value_type;
-#if __cplusplus < 201103L
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
__glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
-#endif
+# endif
__glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
+#endif
template<typename _Tp1, typename _Seq1>
- friend bool
- operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
+ friend bool
+ operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
template<typename _Tp1, typename _Seq1>
- friend bool
- operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
+ friend bool
+ operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
#if __cplusplus >= 201103L
template<typename _Alloc>
#endif
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;
+ 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:
// See queue::c for notes on this name.
{ return c.emplace_back(std::forward<_Args>(__args)...); }
#else
template<typename... _Args>
- void
- emplace(_Args&&... __args)
+ void
+ emplace(_Args&&... __args)
{ c.emplace_back(std::forward<_Args>(__args)...); }
#endif
#endif
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
pointer;
- struct _Vector_impl
+ struct _Vector_impl
: public _Tp_alloc_type
{
pointer _M_start;
std::swap(_M_end_of_storage, __x._M_end_of_storage);
}
};
-
+
public:
typedef _Alloc allocator_type;
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class vector : protected _Vector_base<_Tp, _Alloc>
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// Concept requirements.
typedef typename _Alloc::value_type _Alloc_value_type;
-#if __cplusplus < 201103L
+# if __cplusplus < 201103L
__glibcxx_class_requires(_Tp, _SGIAssignableConcept)
-#endif
+# endif
__glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
-
+#endif
+
typedef _Vector_base<_Tp, _Alloc> _Base;
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits;
at(size_type __n)
{
_M_range_check(__n);
- return (*this)[__n];
+ return (*this)[__n];
}
/**
__glibcxx_requires_nonempty();
return *(end() - 1);
}
-
+
/**
* Returns a read-only (constant) reference to the data at the
* last element of the %vector.
template<typename... _Args>
#if __cplusplus > 201402L
- reference
+ reference
#else
void
#endif
* @param __position An iterator into the %vector.
* @param __l An initializer_list.
*
- * This function will insert copies of the data in the
+ * This function will insert copies of the data in the
* initializer_list @a l into the %vector before the location
* specified by @a position.
*