Unordered: Overhaul the implementation.

Store nodes in a single linked list, with hash values so that their
buckets can be found when needed. Iterators now only have to store a
pointer to the node and don't have to iterate over empty buckets to
reach the next node. This allows the container to meet the iterator
requirements - fixing the speed issues with `equal_range` and `erase`.

Also, define iterators in their own namespace, so that they don't
accidentally pull in detail functions via ADL.

I've simplified the code slightly by removing some of the special
cases for empty containers. Renamed a few things as well and other
minor changes that were made as I went along.

[SVN r71327]
This commit is contained in:
Daniel James committed 2011-04-16 18:47:33 +00:00
1 parent d9c49a6cde
commit 547e141166
14 files changed
+4330 -3985

No files matched your search

@@ -6,12 +6,11 @@
#ifndef BOOST_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED
#define BOOST_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED
#include <boost/config.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/unordered/detail/fwd.hpp>
#include <boost/unordered/detail/table.hpp>
namespace boost {
namespace unordered_detail {
namespace unordered {
namespace detail {
// key extractors
//
@@ -75,7 +74,7 @@ namespace unordered_detail {
struct map_extractor
{
typedef ValueType value_type;
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Key>::type key_type;
typedef BOOST_DEDUCED_TYPENAME ::boost::remove_const<Key>::type key_type;
static key_type const& extract(value_type const& v)
{
@@ -143,6 +142,6 @@ namespace unordered_detail {
return x.second == y.second;
}
};
}}
}}}
#endif