mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 10:57:16 +02:00
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:
@ -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>
|
||||
|
Reference in New Issue
Block a user