gcc/libstdc++-v3/testsuite/23_containers
Jonathan Wakely 83a840a91f PR libstdc++/87194 fix range insertion into maps and sets
Since C++11 range insertion and construction of maps and sets from a
pair of iterators only requires that the iterator's value_type is
convertible to the container's value_type (previously it had to be the
same).

This fixes the implementation to meet that relaxed requirement, by
defining a pair of overloads that either insert or emplace, depending on
the iterator's value_type. Instead of adding yet another overload of
_M_insert_unique and _M_insert_equal, the overloads taking iterators are
renamed to _M_insert_range_unique and _M_insert_range_equal.

	PR libstdc++/87194
	* include/bits/stl_map.h
	(map::map(initializer_list<value_type>, const Compare&, const Alloc&))
	(map::map(initializer_list<value_type>, const Alloc&))
	(map::map(InputIterator, InputIterator, const Alloc&))
	(map::map(InputIterator, InputIterator))
	(map::map(InputIterator, InputIterator, const Compare&, const Alloc&))
	(map::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_multimap.h
	(multimap::multimap(initializer_list<value_type>, const C&, const A&))
	(multimap::multimap(initializer_list<value_type>, const A&))
	(multimap::multimap(InputIterator, InputIterator, const A&))
	(multimap::multimap(InputIterator, InputIterator))
	(multimap::multimap(InputIterator, InputIterator, const C&, const A&))
	(multimap::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_multiset.h
	(multiset::multiset(InputIterator, InputIterator))
	(multiset::multiset(InputIterator, InputIterator, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const A&))
	(multiset::multiset(InputIterator, InputIterator, const A&))
	(multiset::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_set.h
	(set::set(InputIterator, InputIterator))
	(set::set(InputIterator, InputIterator, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Alloc&))
	(set::set(InputIterator, InputIterator, const Alloc&))
	(set::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_tree.h
	[__cplusplus >= 201103L] (_Rb_tree::__same_value_type): New alias
	template for SFINAE constraints.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_unique): Pair of
	constrained overloads that either insert or emplace, depending on
	iterator's value_type.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_equal): Likewise.
	[__cplusplus < 201103L] (_Rb_tree::_M_insert_range_unique)
	(_Rb_tree::_M_insert_range_equal): New functions replacing range
	versions of _M_insert_unique and _M_insert_equal.
	(_Rb_tree::_M_insert_unique(_InputIterator, _InputIterator))
	(_Rb_tree::_M_insert_equal(_InputIterator, _InputIterator)): Remove.
	* testsuite/23_containers/map/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multiset/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/set/modifiers/insert/87194.cc: New test.

From-SVN: r264060
2018-09-03 15:25:25 +01:00
..
array Add whitespace to some dejagnu directives in libstdc++ tests 2018-06-29 10:54:07 +01:00
bitset Update copyright years. 2018-01-03 11:03:58 +01:00
deque Forward declare debug containers so std::pmr aliases work 2018-08-24 18:43:18 +01:00
forward_list 2018-09-02 François Dumont <fdumont@gcc.gnu.org> 2018-09-02 10:20:57 +00:00
headers Update copyright years. 2018-01-03 11:03:58 +01:00
list 2018-09-02 François Dumont <fdumont@gcc.gnu.org> 2018-09-02 10:20:57 +00:00
map PR libstdc++/87194 fix range insertion into maps and sets 2018-09-03 15:25:25 +01:00
multimap PR libstdc++/87194 fix range insertion into maps and sets 2018-09-03 15:25:25 +01:00
multiset PR libstdc++/87194 fix range insertion into maps and sets 2018-09-03 15:25:25 +01:00
priority_queue Update copyright years. 2018-01-03 11:03:58 +01:00
queue Update copyright years. 2018-01-03 11:03:58 +01:00
set PR libstdc++/87194 fix range insertion into maps and sets 2018-09-03 15:25:25 +01:00
stack Update copyright years. 2018-01-03 11:03:58 +01:00
unordered_map PR libstdc++/78595 implement insertion into maps in terms of emplace 2018-09-03 15:25:12 +01:00
unordered_multimap PR libstdc++/78595 implement insertion into maps in terms of emplace 2018-09-03 15:25:12 +01:00
unordered_multiset Forward declare debug containers so std::pmr aliases work 2018-08-24 18:43:18 +01:00
unordered_set Forward declare debug containers so std::pmr aliases work 2018-08-24 18:43:18 +01:00
vector Forward declare debug containers so std::pmr aliases work 2018-08-24 18:43:18 +01:00