+2016-07-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/70716
+ * include/bits/forward_list.h (forward_list): Update doxygen comments
+ to reflect allocator propagation semantics. Remove ambiguous
+ statements about data being lost.
+ * include/bits/stl_deque.h (deque): Likewise.
+ * include/bits/stl_list.h (list): Likewise.
+ * include/bits/stl_map.h (map): Likewise.
+ * include/bits/stl_multimap.h (multimap): Likewise.
+ * include/bits/stl_multiset.h (multiset): Likewise.
+ * include/bits/stl_set.h (set): Likewise.
+ * include/bits/stl_vector.h (vector): Likewise.
+ * include/bits/unordered_map.h (unordered_map, unordered_multimap):
+ Likewise.
+ * include/bits/unordered_set.h (unordered_set, unordered_multiset):
+ Likewise.
+
2016-07-14 Ville Voutilainen <ville.voutilainen@gmail.com>
Implement P0032R3, Homogeneous interface for variant, any and optional,
* @param __list A %forward_list of identical element and allocator
* types.
*
- * All the elements of @a __list are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __list are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
forward_list&
operator=(const forward_list& __list);
*
* The contents of @a __list are moved into this %forward_list
* (without copying, if the allocators permit it).
- * @a __list is a valid, but unspecified %forward_list
+ *
+ * Afterwards @a __list is a valid, but unspecified %forward_list
+ *
+ * Whether the allocator is moved depends on the allocator traits.
*/
forward_list&
operator=(forward_list&& __list)
*
* Note that the assignment completely changes the %forward_list and
* that the number of elements of the resulting %forward_list is the
- * same as the number of elements assigned. Old data is lost.
+ * same as the number of elements assigned.
*/
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
* This function fills a %forward_list with @a __n copies of the
* given value. Note that the assignment completely changes the
* %forward_list, and that the resulting %forward_list has __n
- * elements. Old data is lost.
+ * elements.
*/
void
assign(size_type __n, const _Tp& __val)
* time. Note that the global std::swap() function is
* specialized such that std::swap(l1,l2) will feed to this
* function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(forward_list& __list) noexcept
* @brief %Deque copy constructor.
* @param __x A %deque of identical element and allocator types.
*
- * The newly-created %deque uses a copy of the allocation object used
- * by @a __x.
+ * The newly-created %deque uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
deque(const deque& __x)
: _Base(_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()),
* @brief %Deque assignment operator.
* @param __x A %deque of identical element and allocator types.
*
- * All the elements of @a x are copied, but unlike the copy constructor,
- * the allocator object is not copied.
+ * All the elements of @a x are copied.
+ *
+ * The newly-created %deque uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
deque&
operator=(const deque& __x);
*
* Note that the assignment completely changes the %deque and that the
* resulting %deque's size is the same as the number of elements
- * assigned. Old data may be lost.
+ * assigned.
*/
deque&
operator=(initializer_list<value_type> __l)
* This function fills a %deque with @a n copies of the given
* value. Note that the assignment completely changes the
* %deque and that the resulting %deque's size is the same as
- * the number of elements assigned. Old data may be lost.
+ * the number of elements assigned.
*/
void
assign(size_type __n, const value_type& __val)
*
* Note that the assignment completely changes the %deque and that the
* resulting %deque's size is the same as the number of elements
- * assigned. Old data may be lost.
+ * assigned.
*/
#if __cplusplus >= 201103L
template<typename _InputIterator,
*
* Note that the assignment completely changes the %deque and that the
* resulting %deque's size is the same as the number of elements
- * assigned. Old data may be lost.
+ * assigned.
*/
void
assign(initializer_list<value_type> __l)
* (Four pointers, so it should be quite fast.)
* Note that the global std::swap() function is specialized such that
* std::swap(d1,d2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(deque& __x) _GLIBCXX_NOEXCEPT
* @param __x A %list of identical element and allocator types.
*
* The newly-created %list uses a copy of the allocation object used
- * by @a __x.
+ * by @a __x (unless the allocator traits dictate a different object).
*/
list(const list& __x)
: _Base(_Node_alloc_traits::
}
#endif
+#if __cplusplus >= 201103L
/**
* No explicit dtor needed as the _Base dtor takes care of
* things. The _Base dtor only erases the elements, and note
* memory is not touched in any way. Managing the pointer is
* the user's responsibility.
*/
+ ~list() = default;
+#endif
/**
* @brief %List assignment operator.
* @param __x A %list of identical element and allocator types.
*
- * All the elements of @a __x are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
list&
operator=(const list& __x);
* @param __x A %list of identical element and allocator types.
*
* The contents of @a __x are moved into this %list (without copying).
- * @a __x is a valid, but unspecified %list
+ *
+ * Afterwards @a __x is a valid, but unspecified %list
+ *
+ * Whether the allocator is moved depends on the allocator traits.
*/
list&
operator=(list&& __x)
* This function fills a %list with @a __n copies of the given
* value. Note that the assignment completely changes the %list
* and that the resulting %list's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
void
assign(size_type __n, const value_type& __val)
*
* Note that the assignment completely changes the %list and
* that the resulting %list's size is the same as the number of
- * elements assigned. Old data may be lost.
+ * elements assigned.
*/
#if __cplusplus >= 201103L
template<typename _InputIterator,
* time. Note that the global std::swap() function is
* specialized such that std::swap(l1,l2) will feed to this
* function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(list& __x) _GLIBCXX_NOEXCEPT
* @brief %Map copy constructor.
* @param __x A %map of identical element and allocator types.
*
- * The newly-created %map uses a copy of the allocation object
- * used by @a __x.
+ * The newly-created %map uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
map(const map& __x)
: _M_t(__x._M_t) { }
* @brief %Map assignment operator.
* @param __x A %map of identical element and allocator types.
*
- * All the elements of @a __x are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
map&
operator=(const map& __x)
*
* Note that the assignment completely changes the %map and
* that the resulting %map's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
map&
operator=(initializer_list<value_type> __l)
* stateless and empty), so it should be quite fast.) Note
* that the global std::swap() function is specialized such
* that std::swap(m1,m2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(map& __x)
* @brief %Multimap copy constructor.
* @param __x A %multimap of identical element and allocator types.
*
- * The newly-created %multimap uses a copy of the allocation object
- * used by @a __x.
+ * The newly-created %multimap uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
multimap(const multimap& __x)
: _M_t(__x._M_t) { }
* @brief %Multimap assignment operator.
* @param __x A %multimap of identical element and allocator types.
*
- * All the elements of @a __x are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
multimap&
operator=(const multimap& __x)
*
* Note that the assignment completely changes the %multimap and
* that the resulting %multimap's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
multimap&
operator=(initializer_list<value_type> __l)
* should be quite fast.)
* Note that the global std::swap() function is specialized such that
* std::swap(m1,m2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(multimap& __x)
* @brief %Multiset copy constructor.
* @param __x A %multiset of identical element and allocator types.
*
- * The newly-created %multiset uses a copy of the allocation object used
- * by @a __x.
+ * The newly-created %multiset uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
multiset(const multiset& __x)
: _M_t(__x._M_t) { }
* @brief %Multiset assignment operator.
* @param __x A %multiset of identical element and allocator types.
*
- * All the elements of @a __x are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
multiset&
operator=(const multiset& __x)
*
* Note that the assignment completely changes the %multiset and
* that the resulting %multiset's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
multiset&
operator=(initializer_list<value_type> __l)
* be quite fast.)
* Note that the global std::swap() function is specialized such that
* std::swap(s1,s2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(multiset& __x)
* @brief %Set copy constructor.
* @param __x A %set of identical element and allocator types.
*
- * The newly-created %set uses a copy of the allocation object used
- * by @a __x.
+ * The newly-created %set uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
set(const set& __x)
: _M_t(__x._M_t) { }
* @brief %Set assignment operator.
* @param __x A %set of identical element and allocator types.
*
- * All the elements of @a __x are copied, but unlike the copy
- * constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
set&
operator=(const set& __x)
*
* Note that the assignment completely changes the %set and
* that the resulting %set's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
set&
operator=(initializer_list<value_type> __l)
* stateless and empty), so it should be quite fast.) Note
* that the global std::swap() function is specialized such
* that std::swap(s1,s2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(set& __x)
* @brief %Vector copy constructor.
* @param __x A %vector of identical element and allocator types.
*
- * The newly-created %vector uses a copy of the allocation
- * object used by @a __x. All the elements of @a __x are copied,
- * but any extra memory in
- * @a __x (for fast expansion) will not be copied.
+ * All the elements of @a __x are copied, but any unused capacity in
+ * @a __x will not be copied
+ * (i.e. capacity() == size() in the new %vector).
+ *
+ * The newly-created %vector uses a copy of the allocator object used
+ * by @a __x (unless the allocator traits dictate a different object).
*/
vector(const vector& __x)
: _Base(__x.size(),
* @brief %Vector assignment operator.
* @param __x A %vector of identical element and allocator types.
*
- * All the elements of @a __x are copied, but any extra memory in
- * @a __x (for fast expansion) will not be copied. Unlike the
- * copy constructor, the allocator object is not copied.
+ * All the elements of @a __x are copied, but any unused capacity in
+ * @a __x will not be copied.
+ *
+ * Whether the allocator is copied depends on the allocator traits.
*/
vector&
operator=(const vector& __x);
*
* The contents of @a __x are moved into this %vector (without copying,
* if the allocators permit it).
- * @a __x is a valid, but unspecified %vector.
+ * Afterwards @a __x is a valid, but unspecified %vector.
+ *
+ * Whether the allocator is moved depends on the allocator traits.
*/
vector&
operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
*
* Note that the assignment completely changes the %vector and
* that the resulting %vector's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
vector&
operator=(initializer_list<value_type> __l)
* This function fills a %vector with @a __n copies of the given
* value. Note that the assignment completely changes the
* %vector and that the resulting %vector's size is the same as
- * the number of elements assigned. Old data may be lost.
+ * the number of elements assigned.
*/
void
assign(size_type __n, const value_type& __val)
*
* Note that the assignment completely changes the %vector and
* that the resulting %vector's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
#if __cplusplus >= 201103L
template<typename _InputIterator,
*
* Note that the assignment completely changes the %vector and
* that the resulting %vector's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
void
assign(initializer_list<value_type> __l)
* (Three pointers, so it should be quite fast.)
* Note that the global std::swap() function is specialized such that
* std::swap(v1,v2) will feed to this function.
+ *
+ * Whether the allocators are swapped depends on the allocator traits.
*/
void
swap(vector& __x) _GLIBCXX_NOEXCEPT
*
* Note that the assignment completely changes the %unordered_map and
* that the resulting %unordered_map's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
unordered_map&
operator=(initializer_list<value_type> __l)
return *this;
}
- /// Returns the allocator object with which the %unordered_map was
- /// constructed.
+ /// Returns the allocator object used by the %unordered_map.
allocator_type
get_allocator() const noexcept
{ return _M_h.get_allocator(); }
* @brief %Unordered_multimap list assignment operator.
* @param __l An initializer_list.
*
- * This function fills an %unordered_multimap with copies of the elements
- * in the initializer list @a __l.
+ * This function fills an %unordered_multimap with copies of the
+ * elements in the initializer list @a __l.
*
* Note that the assignment completely changes the %unordered_multimap
* and that the resulting %unordered_multimap's size is the same as the
- * number of elements assigned. Old data may be lost.
+ * number of elements assigned.
*/
unordered_multimap&
operator=(initializer_list<value_type> __l)
return *this;
}
- /// Returns the allocator object with which the %unordered_multimap was
- /// constructed.
+ /// Returns the allocator object used by the %unordered_multimap.
allocator_type
get_allocator() const noexcept
{ return _M_h.get_allocator(); }
*
* Note that the assignment completely changes the %unordered_set and
* that the resulting %unordered_set's size is the same as the number
- * of elements assigned. Old data may be lost.
+ * of elements assigned.
*/
unordered_set&
operator=(initializer_list<value_type> __l)
return *this;
}
- /// Returns the allocator object with which the %unordered_set was
- /// constructed.
+ /// Returns the allocator object used by the %unordered_set.
allocator_type
get_allocator() const noexcept
{ return _M_h.get_allocator(); }
*
* Note that the assignment completely changes the %unordered_multiset
* and that the resulting %unordered_multiset's size is the same as the
- * number of elements assigned. Old data may be lost.
+ * number of elements assigned.
*/
unordered_multiset&
operator=(initializer_list<value_type> __l)
return *this;
}
- /// Returns the allocator object with which the %unordered_multiset was
- /// constructed.
+ /// Returns the allocator object used by the %unordered_multiset.
allocator_type
get_allocator() const noexcept
{ return _M_h.get_allocator(); }