summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext
diff options
context:
space:
mode:
authoraustern <austern@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-18 18:35:38 +0000
committeraustern <austern@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-18 18:35:38 +0000
commit0f9f763311d9f5e59001865f815f8ffbf9bc4868 (patch)
treed71e92d2f714303433e3e6f0e501859221810a08 /libstdc++-v3/include/ext
parente7f8f0ebaf58e558ee94593c4ce8f92c9aee7b93 (diff)
downloadgcc-0f9f763311d9f5e59001865f815f8ffbf9bc4868.tar.gz
* include/bits/demangle.h: Fix allocator type correctness,
i.e. make sure that when we instantiate a container with a value type and an allocator, the allocator's value type matches the container's. * include/bits/stl_deque.h (_Deque_alloc_base): Eliminate. (_Deque_base): inherit directly from the deque's allocator. Use rebinding instead of _Alloc_traits. Pick up data members from _Deque_alloc_base. * include/bits/stl_list.h (_List_alloc_base): Eliminate. (_List_base): Inherit directly from the list's allocator. Use rebinding instead of _Alloc_traits. Pick up data members from _List_alloc_base. * include/bits/stl_vector.h (_Vector_alloc_base): Eliminate (_Vector_base): Inherit directly from the vector's allocator. Use rebinding instead of _Alloc_traits. Pick up data members from _Vector_alloc_base. * include/ext/hashtable.h: Fix allocator type correctness (the vector of buckets must be passed an allocator for objects of type _Node*). Use rebinding instead of _Alloc_traits. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74787 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext')
-rw-r--r--libstdc++-v3/include/ext/hashtable.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/libstdc++-v3/include/ext/hashtable.h b/libstdc++-v3/include/ext/hashtable.h
index 4e5ea097ab7..54540c40aee 100644
--- a/libstdc++-v3/include/ext/hashtable.h
+++ b/libstdc++-v3/include/ext/hashtable.h
@@ -77,7 +77,6 @@ using std::size_t;
using std::ptrdiff_t;
using std::forward_iterator_tag;
using std::input_iterator_tag;
-using std::_Alloc_traits;
using std::_Construct;
using std::_Destroy;
using std::distance;
@@ -242,10 +241,14 @@ private:
typedef _Hashtable_node<_Val> _Node;
public:
- typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type;
+ typedef _Alloc allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; }
private:
- typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator;
+ typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
+ typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
+ typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
+
+ _Node_Alloc _M_node_allocator;
_Node* _M_get_node() { return _M_node_allocator.allocate(1); }
void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
@@ -253,7 +256,7 @@ private:
hasher _M_hash;
key_equal _M_equals;
_ExtractKey _M_get_key;
- vector<_Node*,_Alloc> _M_buckets;
+ _Vector_type _M_buckets;
size_type _M_num_elements;
public:
@@ -876,8 +879,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
if (__num_elements_hint > __old_n) {
const size_type __n = _M_next_size(__num_elements_hint);
if (__n > __old_n) {
- vector<_Node*, _All> __tmp(__n, (_Node*)(0),
- _M_buckets.get_allocator());
+ _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());
try {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket];