diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-04 11:34:45 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-04 11:34:45 +0000 |
commit | 6399fdee744ec0061ce498943d14db4ebad50b70 (patch) | |
tree | cd3bddece803156966caae41da6fe7437f45b8f1 /libstdc++-v3/include/bits/allocator.h | |
parent | 0a316aee7c21a24b53e6c18d214357c7999d7e33 (diff) | |
download | ppe42-gcc-6399fdee744ec0061ce498943d14db4ebad50b70.tar.gz ppe42-gcc-6399fdee744ec0061ce498943d14db4ebad50b70.zip |
2006-01-04 Paolo Carlini <pcarlini@suse.de>
* include/ext/sso_string_base.h (__sso_string_base<>::_M_dataplus):
Use _CharT_alloc_type as base class.
(_M_get_allocator, _M_swap, _M_create, _M_destroy): Adjust.
* include/ext/vstring.h (get_allocator): Tidy.
2006-01-04 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for all the containers.
* include/bits/allocator.h (struct __alloc_swap): Add, swaps
allocators, optimized to nothing in case they are empty.
* include/bits/stl_deque.h (deque<>::swap): Use it.
* include/bits/stl_list.h (list<>::swap): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::swap): Likewise.
* include/bits/stl_vector.h (vector<>::swap): Likewise.
* include/tr1/hashtable (hashtable<>::swap): Likewise.
* include/ext/rc_string_base.h (__rc_string_base<>::_M_swap):
Likewise.
* include/ext/sso_string_base.h (__sso_string_base<>::_M_swap):
Likewise.
* include/ext/vstring_util.h (__vstring_utility<>::_Alloc_hider):
Clean-up (now vstring uses the generic __alloc_swap facility).
* include/tr1/unordered_map: Adjust includes.
* include/tr1/unordered_set: Likewise.
* docs/html/ext/howto.html: Add an entry for DR 431.
* testsuite/23_containers/deque/modifiers/swap.cc: Move to...
* testsuite/23_containers/deque/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/deque/modifiers/swap/2.cc: New.
* testsuite/23_containers/deque/modifiers/swap/3.cc: New.
* testsuite/23_containers/list/modifiers/swap.cc: Move to...
* testsuite/23_containers/list/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/list/modifiers/swap/2.cc: New.
* testsuite/23_containers/list/modifiers/swap/3.cc: New.
* testsuite/23_containers/vector/modifiers/swap.cc: Move to...
* testsuite/23_containers/vector/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/vector/modifiers/swap/2.cc: New.
* testsuite/23_containers/vector/modifiers/swap/3.cc: New.
* testsuite/23_containers/set/modifiers/swap.cc: Move to...
* testsuite/23_containers/set/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/set/modifiers/swap/2.cc: New.
* testsuite/23_containers/set/modifiers/swap/3.cc: New.
* testsuite/23_containers/map/modifiers/swap.cc: Move to...
* testsuite/23_containers/map/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/map/modifiers/swap/2.cc: New.
* testsuite/23_containers/map/modifiers/swap/3.cc: New.
* testsuite/23_containers/multiset/modifiers/swap.cc: Move to...
* testsuite/23_containers/multiset/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/multiset/modifiers/swap/2.cc: New.
* testsuite/23_containers/multiset/modifiers/swap/3.cc: New.
* testsuite/23_containers/multimap/modifiers/swap.cc: Move to...
* testsuite/23_containers/multimap/modifiers/swap/1.cc: ... here.
* testsuite/23_containers/multimap/modifiers/swap/2.cc: New.
* testsuite/23_containers/multimap/modifiers/swap/3.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_set/1.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_set/2.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_map/1.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_map/2.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_multiset/1.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_multiset/2.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_multimap/1.cc: New.
* testsuite/tr1/6_containers/unordered/swap/unordered_multimap/2.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109324 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/allocator.h')
-rw-r--r-- | libstdc++-v3/include/bits/allocator.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 18bfd5f60eb..3e8d94a26e1 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -1,6 +1,7 @@ // Allocators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -128,6 +129,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Undefine. #undef __glibcxx_base_allocator + // To implement Option 3 of DR 431. + template<typename _Alloc, bool = std::__is_empty<_Alloc>::__value> + struct __alloc_swap + { static void _S_do_it(_Alloc&, _Alloc&) { } }; + + template<typename _Alloc> + struct __alloc_swap<_Alloc, false> + { + static void + _S_do_it(_Alloc& __one, _Alloc& __two) + { + // Precondition: swappable allocators. + if (__one != __two) + swap(__one, __two); + } + }; + _GLIBCXX_END_NAMESPACE #endif |