Commit fe62dd04 by François Dumont

stl_deque.h (deque): Access allocator value_type only if concept checks are enabled.

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.

From-SVN: r246294
parent 92279d5f
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
......@@ -351,7 +365,7 @@
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>
......@@ -418,9 +432,9 @@
* 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>
......@@ -440,16 +454,16 @@
* 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".
......@@ -714,7 +728,7 @@
* 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>
......@@ -935,7 +949,7 @@
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>
......@@ -1415,7 +1429,7 @@
* 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.
......
......@@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @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
......@@ -98,19 +98,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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
......@@ -143,15 +147,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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
......@@ -238,10 +242,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// 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
/**
......@@ -254,9 +258,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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.
......@@ -270,11 +274,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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
/**
......@@ -326,7 +330,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// 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
......@@ -530,9 +534,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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
/**
......@@ -567,9 +571,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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
......@@ -583,9 +587,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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
/**
......@@ -661,7 +665,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @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,
......@@ -1016,13 +1020,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
//@}
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>&);
};
......@@ -1039,7 +1043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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; }
/**
......@@ -1056,42 +1060,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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); }
......
......@@ -94,12 +94,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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:
......@@ -122,19 +126,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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;
......@@ -170,9 +174,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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.
......@@ -186,11 +190,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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.
......@@ -250,10 +254,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// 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
......@@ -533,9 +537,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* 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
/**
......@@ -611,7 +615,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @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,
......@@ -866,13 +870,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
//@}
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>&);
};
......
......@@ -95,20 +95,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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>
......@@ -117,11 +121,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#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
......@@ -259,8 +263,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
......@@ -381,12 +385,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* @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).
*
......@@ -418,14 +422,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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>
......@@ -434,11 +442,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#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;
......@@ -461,7 +469,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#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() { }
......@@ -519,33 +527,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
#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);
......@@ -599,8 +607,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
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);
......@@ -631,12 +639,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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);
......@@ -653,7 +661,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#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
......
......@@ -92,12 +92,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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:
......@@ -123,19 +127,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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
......@@ -195,7 +199,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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.
......@@ -254,10 +258,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// 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
......
......@@ -98,21 +98,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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>
......@@ -121,11 +123,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#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.
......@@ -235,8 +237,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ 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
......
......@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
pointer;
struct _Vector_impl
struct _Vector_impl
: public _Tp_alloc_type
{
pointer _M_start;
......@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
std::swap(_M_end_of_storage, __x._M_end_of_storage);
}
};
public:
typedef _Alloc allocator_type;
......@@ -215,13 +215,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
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;
......@@ -842,7 +844,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
at(size_type __n)
{
_M_range_check(__n);
return (*this)[__n];
return (*this)[__n];
}
/**
......@@ -895,7 +897,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__glibcxx_requires_nonempty();
return *(end() - 1);
}
/**
* Returns a read-only (constant) reference to the data at the
* last element of the %vector.
......@@ -953,7 +955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename... _Args>
#if __cplusplus > 201402L
reference
reference
#else
void
#endif
......@@ -1045,7 +1047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment