Add the new allocator constructors, use composition instead of inheritance for the implementation and some small fixes.

Merged revisions 43922,43962,43966,43971,43981,43995-43996,44042,44046-44048,44057 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk

........
  r43922 | danieljames | 2008-03-29 14:55:59 +0000 (Sat, 29 Mar 2008) | 1 line
  
  Fix some typos in the reference documentation.
........
  r43962 | danieljames | 2008-03-31 18:29:59 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Add a name variable to the release script, so that I can have different release names in different branches.
........
  r43966 | danieljames | 2008-03-31 18:43:16 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Fix the image directory for standalone docs.
........
  r43971 | danieljames | 2008-03-31 19:17:25 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Fix the unordered stylesheet.
........
  r43981 | danieljames | 2008-04-01 13:31:26 +0100 (Tue, 01 Apr 2008) | 2 lines
  
  Cast the pointer in the Visual C++ 6.5 _Charalloc method.
........
  r43995 | danieljames | 2008-04-02 12:50:27 +0100 (Wed, 02 Apr 2008) | 1 line
  
  Try using the interprocess containers for testing. Compilation is a bit slower but hopefully I'll run into less cross-platform problems.
........
  r43996 | danieljames | 2008-04-02 13:25:49 +0100 (Wed, 02 Apr 2008) | 1 line
  
  Revert my experiment with the interprocess containers. It didn't work out.
........
  r44042 | danieljames | 2008-04-04 20:38:09 +0100 (Fri, 04 Apr 2008) | 1 line
  
  Make hash table data a member of hash table, instead of a base.
........
  r44046 | danieljames | 2008-04-05 12:38:05 +0100 (Sat, 05 Apr 2008) | 1 line
  
  Remove rvalue_ref from Jamfile.v2 - I didn't mean to check it in.
........
  r44047 | danieljames | 2008-04-05 12:39:38 +0100 (Sat, 05 Apr 2008) | 1 line
  
  New constructors with allocators.
........
  r44048 | danieljames | 2008-04-05 12:58:11 +0100 (Sat, 05 Apr 2008) | 1 line
  
  Document the new constructors.
........
  r44057 | danieljames | 2008-04-05 17:08:23 +0100 (Sat, 05 Apr 2008) | 1 line
  
  Fix some bugs in the exception testing code.
........


[SVN r44417]
This commit is contained in:
Daniel James
2008-04-14 15:10:26 +00:00
parent 6aa582a90e
commit 5989e9227c
12 changed files with 375 additions and 193 deletions

View File

@ -71,6 +71,18 @@ namespace boost
{
}
// TODO: Should this be explicit?
unordered_map(allocator_type const& a)
: base(boost::unordered_detail::default_initial_bucket_count,
hasher(), key_equal(), a)
{
}
unordered_map(unordered_map const& other, allocator_type const& a)
: base(other.base, a)
{
}
template <class InputIterator>
unordered_map(InputIterator f, InputIterator l)
: base(f, l, boost::unordered_detail::default_initial_bucket_count,
@ -124,32 +136,32 @@ namespace boost
iterator begin()
{
return iterator(base.begin());
return iterator(base.data_.begin());
}
const_iterator begin() const
{
return const_iterator(base.begin());
return const_iterator(base.data_.begin());
}
iterator end()
{
return iterator(base.end());
return iterator(base.data_.end());
}
const_iterator end() const
{
return const_iterator(base.end());
return const_iterator(base.data_.end());
}
const_iterator cbegin() const
{
return const_iterator(base.begin());
return const_iterator(base.data_.begin());
}
const_iterator cend() const
{
return const_iterator(base.end());
return const_iterator(base.data_.end());
}
// modifiers
@ -188,7 +200,7 @@ namespace boost
void clear()
{
base.clear();
base.data_.clear();
}
void swap(unordered_map& other)
@ -268,7 +280,7 @@ namespace boost
size_type bucket_size(size_type n) const
{
return base.bucket_size(n);
return base.data_.bucket_size(n);
}
size_type bucket(const key_type& k) const
@ -278,32 +290,32 @@ namespace boost
local_iterator begin(size_type n)
{
return local_iterator(base.begin(n));
return local_iterator(base.data_.begin(n));
}
const_local_iterator begin(size_type n) const
{
return const_local_iterator(base.begin(n));
return const_local_iterator(base.data_.begin(n));
}
local_iterator end(size_type n)
{
return local_iterator(base.end(n));
return local_iterator(base.data_.end(n));
}
const_local_iterator end(size_type n) const
{
return const_local_iterator(base.end(n));
return const_local_iterator(base.data_.end(n));
}
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
return const_local_iterator(base.data_.begin(n));
}
const_local_iterator cend(size_type n) const
{
return const_local_iterator(base.end(n));
return const_local_iterator(base.data_.end(n));
}
// hash policy
@ -384,6 +396,17 @@ namespace boost
{
}
unordered_multimap(allocator_type const& a)
: base(boost::unordered_detail::default_initial_bucket_count,
hasher(), key_equal(), a)
{
}
unordered_multimap(unordered_multimap const& other, allocator_type const& a)
: base(other.base, a)
{
}
template <class InputIterator>
unordered_multimap(InputIterator f, InputIterator l)
: base(f, l, boost::unordered_detail::default_initial_bucket_count,
@ -437,32 +460,32 @@ namespace boost
iterator begin()
{
return iterator(base.begin());
return iterator(base.data_.begin());
}
const_iterator begin() const
{
return const_iterator(base.begin());
return const_iterator(base.data_.begin());
}
iterator end()
{
return iterator(base.end());
return iterator(base.data_.end());
}
const_iterator end() const
{
return const_iterator(base.end());
return const_iterator(base.data_.end());
}
const_iterator cbegin() const
{
return const_iterator(base.begin());
return const_iterator(base.data_.begin());
}
const_iterator cend() const
{
return const_iterator(base.end());
return const_iterator(base.data_.end());
}
// modifiers
@ -500,7 +523,7 @@ namespace boost
void clear()
{
base.clear();
base.data_.clear();
}
void swap(unordered_multimap& other)
@ -565,7 +588,7 @@ namespace boost
size_type bucket_size(size_type n) const
{
return base.bucket_size(n);
return base.data_.bucket_size(n);
}
size_type bucket(const key_type& k) const
@ -575,32 +598,32 @@ namespace boost
local_iterator begin(size_type n)
{
return local_iterator(base.begin(n));
return local_iterator(base.data_.begin(n));
}
const_local_iterator begin(size_type n) const
{
return const_local_iterator(base.begin(n));
return const_local_iterator(base.data_.begin(n));
}
local_iterator end(size_type n)
{
return local_iterator(base.end(n));
return local_iterator(base.data_.end(n));
}
const_local_iterator end(size_type n) const
{
return const_local_iterator(base.end(n));
return const_local_iterator(base.data_.end(n));
}
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
return const_local_iterator(base.data_.begin(n));
}
const_local_iterator cend(size_type n) const
{
return const_local_iterator(base.end(n));
return const_local_iterator(base.data_.end(n));
}
// hash policy