forked from boostorg/unordered
New version of the unordered associative containers, with a more efficient data
structure for unordered_multimap/unordered_multiset that uses an extra pointer per node but makes most operations more efficient when equivalent nodes are present. Now uses macros instead of template metaprogramming to implement the differences between containers with equivalent and unique keys. Removed the erase_iterator stuff which complicated matters more than it helped. Now just using pointers with some helper functions. [SVN r2950]
This commit is contained in:
1 parent
d3b8b2f38d
commit
9bd73e4ba7
4 files changed
+2182
-1849
No files matched your search
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -36,9 +36,8 @@ namespace boost
|
||||
class unordered_map
|
||||
{
|
||||
// Named for the benefit of Doxygen.
|
||||
typedef boost::unordered_detail::hash_types<
|
||||
std::pair<const Key, T>, Key, Hash,
|
||||
Pred, Alloc, false
|
||||
typedef boost::unordered_detail::hash_types_unique_keys<
|
||||
std::pair<const Key, T>, Key, Hash, Pred, Alloc
|
||||
> implementation_defined;
|
||||
|
||||
typename implementation_defined::hash_table base;
|
||||
@@ -187,17 +186,17 @@ namespace boost
|
||||
std::pair<iterator, bool> insert(const value_type& obj)
|
||||
{
|
||||
return boost::unordered_detail::pair_cast<iterator, bool>(
|
||||
base.insert_unique(obj));
|
||||
base.insert(obj));
|
||||
}
|
||||
|
||||
iterator insert(iterator hint, const value_type& obj)
|
||||
{
|
||||
return iterator(base.insert_unique(get(hint), obj));
|
||||
return iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
const_iterator insert(const_iterator hint, const value_type& obj)
|
||||
{
|
||||
return const_iterator(base.insert_unique(get(hint), obj));
|
||||
return const_iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
@@ -386,9 +385,8 @@ namespace boost
|
||||
class unordered_multimap
|
||||
{
|
||||
// Named for the benefit of Doxygen.
|
||||
typedef boost::unordered_detail::hash_types<
|
||||
std::pair<const Key, T>, Key, Hash,
|
||||
Pred, Alloc, true
|
||||
typedef boost::unordered_detail::hash_types_equivalent_keys<
|
||||
std::pair<const Key, T>, Key, Hash, Pred, Alloc
|
||||
> implementation_defined;
|
||||
|
||||
typename implementation_defined::hash_table base;
|
||||
@@ -511,17 +509,17 @@ namespace boost
|
||||
|
||||
iterator insert(const value_type& obj)
|
||||
{
|
||||
return iterator(base.insert_equivalent(obj));
|
||||
return iterator(base.insert(obj));
|
||||
}
|
||||
|
||||
iterator insert(iterator hint, const value_type& obj)
|
||||
{
|
||||
return iterator(base.insert_equivalent(get(hint), obj));
|
||||
return iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
const_iterator insert(const_iterator hint, const value_type& obj)
|
||||
{
|
||||
return const_iterator(base.insert_equivalent(get(hint), obj));
|
||||
return const_iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
|
||||
@@ -35,9 +35,8 @@ namespace boost
|
||||
class unordered_set
|
||||
{
|
||||
// Named for the benefit of Doxygen.
|
||||
typedef boost::unordered_detail::hash_types<
|
||||
Value, Value, Hash,
|
||||
Pred, Alloc, false
|
||||
typedef boost::unordered_detail::hash_types_unique_keys<
|
||||
Value, Value, Hash, Pred, Alloc
|
||||
> implementation_defined;
|
||||
|
||||
typename implementation_defined::hash_table base;
|
||||
@@ -159,12 +158,12 @@ namespace boost
|
||||
std::pair<iterator, bool> insert(const value_type& obj)
|
||||
{
|
||||
return boost::unordered_detail::pair_cast<iterator, bool>(
|
||||
base.insert_unique(obj));
|
||||
base.insert(obj));
|
||||
}
|
||||
|
||||
const_iterator insert(const_iterator hint, const value_type& obj)
|
||||
{
|
||||
return const_iterator(base.insert_unique(get(hint), obj));
|
||||
return const_iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
@@ -325,9 +324,8 @@ namespace boost
|
||||
class unordered_multiset
|
||||
{
|
||||
// Named for the benefit of Doxygen.
|
||||
typedef boost::unordered_detail::hash_types<
|
||||
Value, Value, Hash,
|
||||
Pred, Alloc, true
|
||||
typedef boost::unordered_detail::hash_types_equivalent_keys<
|
||||
Value, Value, Hash, Pred, Alloc
|
||||
> implementation_defined;
|
||||
|
||||
typename implementation_defined::hash_table base;
|
||||
@@ -448,12 +446,12 @@ namespace boost
|
||||
|
||||
iterator insert(const value_type& obj)
|
||||
{
|
||||
return iterator(base.insert_equivalent(obj));
|
||||
return iterator(base.insert(obj));
|
||||
}
|
||||
|
||||
const_iterator insert(const_iterator hint, const value_type& obj)
|
||||
{
|
||||
return const_iterator(base.insert_equivalent(get(hint), obj));
|
||||
return const_iterator(base.insert(get(hint), obj));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
|
||||
Reference in new issue
Block a user