mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +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:
File diff suppressed because it is too large
Load Diff
2112
include/boost/unordered/detail/hash_table_impl.hpp
Normal file
2112
include/boost/unordered/detail/hash_table_impl.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -36,9 +36,8 @@ namespace boost
|
|||||||
class unordered_map
|
class unordered_map
|
||||||
{
|
{
|
||||||
// Named for the benefit of Doxygen.
|
// Named for the benefit of Doxygen.
|
||||||
typedef boost::unordered_detail::hash_types<
|
typedef boost::unordered_detail::hash_types_unique_keys<
|
||||||
std::pair<const Key, T>, Key, Hash,
|
std::pair<const Key, T>, Key, Hash, Pred, Alloc
|
||||||
Pred, Alloc, false
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
|
|
||||||
typename implementation_defined::hash_table base;
|
typename implementation_defined::hash_table base;
|
||||||
@ -187,17 +186,17 @@ namespace boost
|
|||||||
std::pair<iterator, bool> insert(const value_type& obj)
|
std::pair<iterator, bool> insert(const value_type& obj)
|
||||||
{
|
{
|
||||||
return boost::unordered_detail::pair_cast<iterator, bool>(
|
return boost::unordered_detail::pair_cast<iterator, bool>(
|
||||||
base.insert_unique(obj));
|
base.insert(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator insert(iterator hint, const value_type& 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)
|
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>
|
template <class InputIterator>
|
||||||
@ -386,9 +385,8 @@ namespace boost
|
|||||||
class unordered_multimap
|
class unordered_multimap
|
||||||
{
|
{
|
||||||
// Named for the benefit of Doxygen.
|
// Named for the benefit of Doxygen.
|
||||||
typedef boost::unordered_detail::hash_types<
|
typedef boost::unordered_detail::hash_types_equivalent_keys<
|
||||||
std::pair<const Key, T>, Key, Hash,
|
std::pair<const Key, T>, Key, Hash, Pred, Alloc
|
||||||
Pred, Alloc, true
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
|
|
||||||
typename implementation_defined::hash_table base;
|
typename implementation_defined::hash_table base;
|
||||||
@ -511,17 +509,17 @@ namespace boost
|
|||||||
|
|
||||||
iterator insert(const value_type& obj)
|
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)
|
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)
|
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>
|
template <class InputIterator>
|
||||||
|
@ -35,9 +35,8 @@ namespace boost
|
|||||||
class unordered_set
|
class unordered_set
|
||||||
{
|
{
|
||||||
// Named for the benefit of Doxygen.
|
// Named for the benefit of Doxygen.
|
||||||
typedef boost::unordered_detail::hash_types<
|
typedef boost::unordered_detail::hash_types_unique_keys<
|
||||||
Value, Value, Hash,
|
Value, Value, Hash, Pred, Alloc
|
||||||
Pred, Alloc, false
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
|
|
||||||
typename implementation_defined::hash_table base;
|
typename implementation_defined::hash_table base;
|
||||||
@ -159,12 +158,12 @@ namespace boost
|
|||||||
std::pair<iterator, bool> insert(const value_type& obj)
|
std::pair<iterator, bool> insert(const value_type& obj)
|
||||||
{
|
{
|
||||||
return boost::unordered_detail::pair_cast<iterator, bool>(
|
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)
|
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>
|
template <class InputIterator>
|
||||||
@ -325,9 +324,8 @@ namespace boost
|
|||||||
class unordered_multiset
|
class unordered_multiset
|
||||||
{
|
{
|
||||||
// Named for the benefit of Doxygen.
|
// Named for the benefit of Doxygen.
|
||||||
typedef boost::unordered_detail::hash_types<
|
typedef boost::unordered_detail::hash_types_equivalent_keys<
|
||||||
Value, Value, Hash,
|
Value, Value, Hash, Pred, Alloc
|
||||||
Pred, Alloc, true
|
|
||||||
> implementation_defined;
|
> implementation_defined;
|
||||||
|
|
||||||
typename implementation_defined::hash_table base;
|
typename implementation_defined::hash_table base;
|
||||||
@ -448,12 +446,12 @@ namespace boost
|
|||||||
|
|
||||||
iterator insert(const value_type& obj)
|
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)
|
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>
|
template <class InputIterator>
|
||||||
|
Reference in New Issue
Block a user