gcc/libstdc++-v3/include/ext
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
..
pb_ds Update copyright years. 2018-01-03 11:03:58 +01:00
algorithm Update copyright years. 2018-01-03 11:03:58 +01:00
aligned_buffer.h aligned_buffer.h [...] (template<> __aligned_buffer): Define as __aligned_membuf alias. 2018-02-20 20:51:44 +00:00
alloc_traits.h Update copyright years. 2018-01-03 11:03:58 +01:00
array_allocator.h Update copyright years. 2018-01-03 11:03:58 +01:00
atomicity.h Update copyright years. 2018-01-03 11:03:58 +01:00
bitmap_allocator.h Update copyright years. 2018-01-03 11:03:58 +01:00
cast.h Update copyright years. 2018-01-03 11:03:58 +01:00
cmath Update copyright years. 2018-01-03 11:03:58 +01:00
codecvt_specializations.h Update copyright years. 2018-01-03 11:03:58 +01:00
concurrence.h Update copyright years. 2018-01-03 11:03:58 +01:00
debug_allocator.h Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
enc_filebuf.h Update copyright years. 2018-01-03 11:03:58 +01:00
extptr_allocator.h Update copyright years. 2018-01-03 11:03:58 +01:00
functional Update copyright years. 2018-01-03 11:03:58 +01:00
iterator Update copyright years. 2018-01-03 11:03:58 +01:00
malloc_allocator.h Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
memory 2018-06-05 François Dumont <fdumont@gcc.gnu.org> 2018-06-05 05:47:44 +00:00
mt_allocator.h Update copyright years. 2018-01-03 11:03:58 +01:00
new_allocator.h Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
numeric Update copyright years. 2018-01-03 11:03:58 +01:00
numeric_traits.h Update copyright years. 2018-01-03 11:03:58 +01:00
pod_char_traits.h Update copyright years. 2018-01-03 11:03:58 +01:00
pointer.h Fix __gnu_cxx::_Pointer_adapter for long long arithmetic 2018-08-30 13:24:06 +01:00
pool_allocator.h Update copyright years. 2018-01-03 11:03:58 +01:00
random P0935R0 Eradicating unnecessarily explicit default constructors 2018-06-14 14:32:53 +01:00
random.tcc PR libstdc++/85749 constrain seed sequences for random number engines 2018-05-15 16:36:46 +01:00
rb_tree Update copyright years. 2018-01-03 11:03:58 +01:00
rc_string_base.h Update copyright years. 2018-01-03 11:03:58 +01:00
rope Rope iterators: don't retain pointers when copied 2018-08-14 12:23:50 +01:00
ropeimpl.h Update copyright years. 2018-01-03 11:03:58 +01:00
slist Update copyright years. 2018-01-03 11:03:58 +01:00
sso_string_base.h Update copyright years. 2018-01-03 11:03:58 +01:00
stdio_filebuf.h Update copyright years. 2018-01-03 11:03:58 +01:00
stdio_sync_filebuf.h Update copyright years. 2018-01-03 11:03:58 +01:00
string_conversions.h Update copyright years. 2018-01-03 11:03:58 +01:00
throw_allocator.h Add missing checks for _GLIBCXX_USE_C99_STDINT_TR1 2018-07-26 15:02:11 +01:00
type_traits.h Update copyright years. 2018-01-03 11:03:58 +01:00
typelist.h Update copyright years. 2018-01-03 11:03:58 +01:00
vstring.h Remove char16_t and char32_t dependency on <stdint.h> 2018-07-26 15:02:01 +01:00
vstring.tcc Update copyright years. 2018-01-03 11:03:58 +01:00
vstring_fwd.h Remove char16_t and char32_t dependency on <stdint.h> 2018-07-26 15:02:01 +01:00
vstring_util.h Update copyright years. 2018-01-03 11:03:58 +01:00