gcc/libstdc++-v3/include
Jonathan Wakely c7790bdbd9 Make ext allocators support heterogeneous equality comparison
The Allocator requirements include the ability to compare different
specializations of the same allocator class template. This did not work
for __gnu_cxx::new_allocator and other extension allocators.  This patch
replaces the equality operators for those allocators with inline friends
that support heterogeneous comparisons.  (I'm not changing all ext
allocators because some are bit-rotted already).

Additionally, the equality operators for comparing two std::allocator
objects of the same type are now defined as inline friends. Those
overloads don't need to be declared at namespace scope, because they
aren't specified in the standard (but they're needed in this
implementation to avoid ambiguities caused by the extra overloads
defined for the base allocator type).

	* include/bits/allocator.h
	(operator==(const allocator<_Tp>&, const allocator<_Tp>))
	(operator!=(const allocator<_Tp>&, const allocator<_Tp>)): Replace
	with inline friends.
	* include/ext/debug_allocator.h (operator==, operator!=): Replace
	with inline friend functions that compare to rebound allocators.
	* include/ext/malloc_allocator.h (operator==, operator!=): Likewise.
	* include/ext/new_allocator.h (operator==, operator!=): Likewise.
	* testsuite/ext/debug_allocator/eq.cc: New test.
	* testsuite/ext/ext_pointer/alloc_eq.cc: New test.
	* testsuite/ext/malloc_allocator/eq.cc: New test.
	* testsuite/ext/new_allocator/eq.cc: New test.

From-SVN: r265036
2018-10-11 12:32:29 +01:00
..
backward P0935R0 Eradicating unnecessarily explicit default constructors 2018-06-14 15:12:24 +01:00
bits Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
c
c_compatibility
c_global Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1 2018-07-26 15:01:55 +01:00
c_std
debug list (list<>::cbegin()): Use C++11 direct initialization. 2018-10-08 05:49:12 +00:00
decimal
experimental PR libstdc++/87061 remove pmr type aliases for COW strings 2018-08-22 23:54:33 +01:00
ext Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
parallel
precompiled Add initial version of C++17 <memory_resource> header 2018-07-24 22:09:55 +01:00
profile
std PR libstdc++/87538 fix std::not_fn exception specifications 2018-10-08 13:07:22 +01:00
tr1 Fix warning with -Wsign-compare -Wsystem-headers 2018-08-16 18:16:33 +01:00
tr2
Makefile.am Add <bit> and <version> to freestanding headers 2018-08-13 19:54:34 +01:00
Makefile.in Add <bit> and <version> to freestanding headers 2018-08-13 19:54:34 +01:00