Use 'E' for key extractor, freeing 'K' for key.

[SVN r57797]
This commit is contained in:
Daniel James
2009-11-20 08:02:48 +00:00
parent 55957bbab5
commit 26c72f9860
4 changed files with 163 additions and 163 deletions

View File

@ -15,9 +15,9 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Equality
template <class H, class P, class A, class K>
bool hash_equivalent_table<H, P, A, K>
::equals(hash_equivalent_table<H, P, A, K> const& other) const
template <class H, class P, class A, class E>
bool hash_equivalent_table<H, P, A, E>
::equals(hash_equivalent_table<H, P, A, E> const& other) const
{
if(this->size_ != other.size_) return false;
if(!this->size_) return true;
@ -51,9 +51,9 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// A convenience method for adding nodes.
template <class H, class P, class A, class K>
inline BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, K>::node_ptr
hash_equivalent_table<H, P, A, K>
template <class H, class P, class A, class E>
inline BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, E>::node_ptr
hash_equivalent_table<H, P, A, E>
::add_node(node_constructor& a, bucket_ptr bucket, node_ptr pos)
{
node_ptr n = a.release();
@ -72,10 +72,10 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Insert methods
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
inline BOOST_DEDUCED_TYPENAME
hash_equivalent_table<H, P, A, K>::iterator_base
hash_equivalent_table<H, P, A, K>::emplace_impl(node_constructor& a)
hash_equivalent_table<H, P, A, E>::iterator_base
hash_equivalent_table<H, P, A, E>::emplace_impl(node_constructor& a)
{
key_type const& k = this->get_key(a.value());
std::size_t hash_value = this->hash_function()(k);
@ -96,8 +96,8 @@ namespace boost { namespace unordered_detail {
}
}
template <class H, class P, class A, class K>
inline void hash_equivalent_table<H, P, A, K>
template <class H, class P, class A, class E>
inline void hash_equivalent_table<H, P, A, E>
::emplace_impl_no_rehash(node_constructor& a)
{
key_type const& k = this->get_key(a.value());
@ -112,10 +112,10 @@ namespace boost { namespace unordered_detail {
// if hash function throws, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class... Args>
BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, K>::iterator_base
hash_equivalent_table<H, P, A, K>
BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, E>::iterator_base
hash_equivalent_table<H, P, A, E>
::emplace(Args&&... args)
{
// Create the node before rehashing in case it throws an
@ -129,10 +129,10 @@ namespace boost { namespace unordered_detail {
#else
#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \
template <class H, class P, class A, class K> \
template <class H, class P, class A, class E> \
template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \
BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, K>::iterator_base \
hash_equivalent_table<H, P, A, K> \
BOOST_DEDUCED_TYPENAME hash_equivalent_table<H, P, A, E>::iterator_base \
hash_equivalent_table<H, P, A, E> \
::emplace(BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \
{ \
node_constructor a(*this); \
@ -151,9 +151,9 @@ namespace boost { namespace unordered_detail {
// if hash function throws, or inserting > 1 element, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class I>
inline void hash_equivalent_table<H, P, A, K>
inline void hash_equivalent_table<H, P, A, E>
::insert_for_range(I i, I j, forward_traversal_tag)
{
if(i == j) return;
@ -182,9 +182,9 @@ namespace boost { namespace unordered_detail {
// if hash function throws, or inserting > 1 element, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class I>
inline void hash_equivalent_table<H, P, A, K>
inline void hash_equivalent_table<H, P, A, E>
::insert_for_range(I i, I j, boost::incrementable_traversal_tag)
{
node_constructor a(*this);
@ -196,9 +196,9 @@ namespace boost { namespace unordered_detail {
// if hash function throws, or inserting > 1 element, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class I>
void hash_equivalent_table<H, P, A, K>::insert_range(I i, I j)
void hash_equivalent_table<H, P, A, E>::insert_range(I i, I j)
{
BOOST_DEDUCED_TYPENAME boost::iterator_traversal<I>::type
iterator_traversal_tag;

View File

@ -29,7 +29,7 @@
// P = Predicate
// A = Value Allocator
// G = Grouped/Ungrouped
// K = Key Extractor
// E = Key Extractor
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
@ -424,7 +424,7 @@ namespace boost { namespace unordered_detail {
}
};
template <class H, class P, class A, class G, class K>
template <class H, class P, class A, class G, class E>
class hash_table :
public hash_buckets<A, G>,
public hash_buffered_functions<H, P>
@ -434,7 +434,7 @@ namespace boost { namespace unordered_detail {
typedef H hasher;
typedef P key_equal;
typedef A value_allocator;
typedef K key_extractor;
typedef E key_extractor;
typedef hash_buffered_functions<H, P> base;
typedef hash_buckets<A, G> buckets;
@ -563,18 +563,18 @@ namespace boost { namespace unordered_detail {
node_constructor&, std::size_t);
};
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
class hash_unique_table :
public hash_table<H, P, A, ungrouped, K>
public hash_table<H, P, A, ungrouped, E>
{
public:
typedef H hasher;
typedef P key_equal;
typedef A value_allocator;
typedef K key_extractor;
typedef E key_extractor;
typedef hash_table<H, P, A, ungrouped, K> table;
typedef hash_table<H, P, A, ungrouped, E> table;
typedef hash_node_constructor<A, ungrouped> node_constructor;
typedef BOOST_DEDUCED_TYPENAME table::key_type key_type;
@ -657,18 +657,18 @@ namespace boost { namespace unordered_detail {
void insert_range_impl(no_key, InputIt i, InputIt j);
};
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
class hash_equivalent_table :
public hash_table<H, P, A, grouped, K>
public hash_table<H, P, A, grouped, E>
{
public:
typedef H hasher;
typedef P key_equal;
typedef A value_allocator;
typedef K key_extractor;
typedef E key_extractor;
typedef hash_table<H, P, A, grouped, K> table;
typedef hash_table<H, P, A, grouped, E> table;
typedef hash_node_constructor<A, grouped> node_constructor;
typedef hash_iterator_base<A, grouped> iterator_base;

View File

@ -21,17 +21,17 @@ namespace boost { namespace unordered_detail {
// Helper methods
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
inline bool hash_table<H, P, A, G, K>::equal(
template <class H, class P, class A, class G, class E>
inline bool hash_table<H, P, A, G, E>::equal(
key_type const& k, value_type const& v) const
{
return this->key_eq()(k, get_key(v));
}
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::node_ptr
hash_table<H, P, A, G, K>::find_iterator(
template <class H, class P, class A, class G, class E>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::node_ptr
hash_table<H, P, A, G, E>::find_iterator(
bucket_ptr bucket, key_type const& k) const
{
node_ptr it = bucket->next_;
@ -46,17 +46,17 @@ namespace boost { namespace unordered_detail {
// strong exception safety, no side effects
// pre: this->buckets_
template <class H, class P, class A, class G, class K>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::node_ptr
hash_table<H, P, A, G, K>::find_iterator(key_type const& k) const
template <class H, class P, class A, class G, class E>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::node_ptr
hash_table<H, P, A, G, E>::find_iterator(key_type const& k) const
{
return find_iterator(this->get_bucket(this->bucket_index(k)), k);
}
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::node_ptr*
hash_table<H, P, A, G, K>::find_for_erase(
template <class H, class P, class A, class G, class E>
inline BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::node_ptr*
hash_table<H, P, A, G, E>::find_for_erase(
bucket_ptr bucket, key_type const& k) const
{
node_ptr* it = &bucket->next_;
@ -73,8 +73,8 @@ namespace boost { namespace unordered_detail {
// Load methods
// no throw
template <class H, class P, class A, class G, class K>
std::size_t hash_table<H, P, A, G, K>::max_size() const
template <class H, class P, class A, class G, class E>
std::size_t hash_table<H, P, A, G, E>::max_size() const
{
using namespace std;
@ -84,8 +84,8 @@ namespace boost { namespace unordered_detail {
}
// strong safety
template <class H, class P, class A, class G, class K>
inline std::size_t hash_table<H, P, A, G, K>::bucket_index(
template <class H, class P, class A, class G, class E>
inline std::size_t hash_table<H, P, A, G, E>::bucket_index(
key_type const& k) const
{
// hash_function can throw:
@ -94,8 +94,8 @@ namespace boost { namespace unordered_detail {
// no throw
template <class H, class P, class A, class G, class K>
inline std::size_t hash_table<H, P, A, G, K>::calculate_max_load()
template <class H, class P, class A, class G, class E>
inline std::size_t hash_table<H, P, A, G, E>::calculate_max_load()
{
using namespace std;
@ -104,8 +104,8 @@ namespace boost { namespace unordered_detail {
return double_to_size_t(ceil((double) mlf_ * this->bucket_count_));
}
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>::max_load_factor(float z)
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>::max_load_factor(float z)
{
BOOST_ASSERT(z > 0);
mlf_ = (std::max)(z, minimum_max_load_factor);
@ -113,8 +113,8 @@ namespace boost { namespace unordered_detail {
}
// no throw
template <class H, class P, class A, class G, class K>
inline std::size_t hash_table<H, P, A, G, K>::min_buckets_for_size(
template <class H, class P, class A, class G, class E>
inline std::size_t hash_table<H, P, A, G, E>::min_buckets_for_size(
std::size_t size) const
{
BOOST_ASSERT(this->mlf_ != 0);
@ -135,8 +135,8 @@ namespace boost { namespace unordered_detail {
// init_buckets
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::init_buckets()
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::init_buckets()
{
if (this->size_) {
this->cached_begin_bucket_ = this->buckets_;
@ -153,8 +153,8 @@ namespace boost { namespace unordered_detail {
//
// no throw
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::recompute_begin_bucket(bucket_ptr b)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::recompute_begin_bucket(bucket_ptr b)
{
BOOST_ASSERT(!(b < this->cached_begin_bucket_));
@ -174,8 +174,8 @@ namespace boost { namespace unordered_detail {
//
// no throw
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::recompute_begin_bucket(
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::recompute_begin_bucket(
bucket_ptr b1, bucket_ptr b2)
{
BOOST_ASSERT(!(b1 < this->cached_begin_bucket_) && !(b2 < b1));
@ -186,8 +186,8 @@ namespace boost { namespace unordered_detail {
}
// no throw
template <class H, class P, class A, class G, class K>
inline float hash_table<H, P, A, G, K>::load_factor() const
template <class H, class P, class A, class G, class E>
inline float hash_table<H, P, A, G, E>::load_factor() const
{
BOOST_ASSERT(this->bucket_count_ != 0);
return static_cast<float>(this->size_)
@ -197,8 +197,8 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Constructors
template <class H, class P, class A, class G, class K>
hash_table<H, P, A, G, K>::hash_table(std::size_t num_buckets,
template <class H, class P, class A, class G, class E>
hash_table<H, P, A, G, E>::hash_table(std::size_t num_buckets,
hasher const& hf, key_equal const& eq, node_allocator const& a)
: buckets(a, next_prime(num_buckets)),
base(hf, eq),
@ -211,8 +211,8 @@ namespace boost { namespace unordered_detail {
// Copy Construct with allocator
template <class H, class P, class A, class G, class K>
hash_table<H, P, A, G, K>::hash_table(hash_table const& x,
template <class H, class P, class A, class G, class E>
hash_table<H, P, A, G, E>::hash_table(hash_table const& x,
node_allocator const& a)
: buckets(a, x.min_buckets_for_size(x.size_)),
base(x),
@ -229,8 +229,8 @@ namespace boost { namespace unordered_detail {
// Move Construct
template <class H, class P, class A, class G, class K>
hash_table<H, P, A, G, K>::hash_table(hash_table& x, move_tag)
template <class H, class P, class A, class G, class E>
hash_table<H, P, A, G, E>::hash_table(hash_table& x, move_tag)
: buckets(x.node_alloc(), x.bucket_count_),
base(x),
size_(0),
@ -241,8 +241,8 @@ namespace boost { namespace unordered_detail {
this->partial_swap(x);
}
template <class H, class P, class A, class G, class K>
hash_table<H, P, A, G, K>::hash_table(hash_table& x,
template <class H, class P, class A, class G, class E>
hash_table<H, P, A, G, E>::hash_table(hash_table& x,
node_allocator const& a, move_tag)
: buckets(a, x.bucket_count_),
base(x),
@ -261,8 +261,8 @@ namespace boost { namespace unordered_detail {
}
}
template <class H, class P, class A, class G, class K>
hash_table<H, P, A, G, K>& hash_table<H, P, A, G, K>::operator=(
template <class H, class P, class A, class G, class E>
hash_table<H, P, A, G, E>& hash_table<H, P, A, G, K>::operator=(
hash_table const& x)
{
hash_table tmp(x, this->node_alloc());
@ -280,8 +280,8 @@ namespace boost { namespace unordered_detail {
// Can throw if hash or predicate object's copy constructor throws
// or if allocators are unequal.
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::partial_swap(hash_table& x)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::partial_swap(hash_table& x)
{
this->buckets::swap(x); // No throw
std::swap(this->size_, x.size_);
@ -290,8 +290,8 @@ namespace boost { namespace unordered_detail {
std::swap(this->max_load_, x.max_load_);
}
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::fast_swap(hash_table& x)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::fast_swap(hash_table& x)
{
// These can throw, but they only affect the function objects
// that aren't in use so it is strongly exception safe, via.
@ -309,8 +309,8 @@ namespace boost { namespace unordered_detail {
std::swap(this->max_load_, x.max_load_);
}
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::slow_swap(hash_table& x)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::slow_swap(hash_table& x)
{
if(this == &x) return;
@ -345,8 +345,8 @@ namespace boost { namespace unordered_detail {
if(x.buckets_) x.init_buckets();
}
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>::swap(hash_table& x)
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>::swap(hash_table& x)
{
if(this->node_alloc() == x.node_alloc()) {
if(this != &x) this->fast_swap(x);
@ -364,8 +364,8 @@ namespace boost { namespace unordered_detail {
// Can throw if hash or predicate object's copy constructor throws
// or if allocators are unequal.
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>::move(hash_table& x)
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>::move(hash_table& x)
{
// This can throw, but it only affects the function objects
// that aren't in use so it is strongly exception safe, via.
@ -402,8 +402,8 @@ namespace boost { namespace unordered_detail {
// Reserve & Rehash
// basic exception safety
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::create_for_insert(std::size_t size)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::create_for_insert(std::size_t size)
{
this->bucket_count_ = (std::max)(this->bucket_count_,
this->min_buckets_for_size(size));
@ -412,8 +412,8 @@ namespace boost { namespace unordered_detail {
}
// basic exception safety
template <class H, class P, class A, class G, class K>
inline bool hash_table<H, P, A, G, K>::reserve_for_insert(std::size_t size)
template <class H, class P, class A, class G, class E>
inline bool hash_table<H, P, A, G, E>::reserve_for_insert(std::size_t size)
{
if(size >= max_load_) {
std::size_t num_buckets
@ -431,8 +431,8 @@ namespace boost { namespace unordered_detail {
// if hash function throws, basic exception safety
// strong otherwise.
template <class H, class P, class A, class G, class K>
inline void hash_table<H, P, A, G, K>::rehash(std::size_t min_buckets)
template <class H, class P, class A, class G, class E>
inline void hash_table<H, P, A, G, E>::rehash(std::size_t min_buckets)
{
using namespace std;
@ -451,8 +451,8 @@ namespace boost { namespace unordered_detail {
// if hash function throws, basic exception safety
// strong otherwise
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>
::rehash_impl(std::size_t num_buckets)
{
hasher const& hf = this->hash_function();
@ -500,8 +500,8 @@ namespace boost { namespace unordered_detail {
// basic excpetion safety. If an exception is thrown this will
// leave dst partially filled.
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>
::copy_buckets_to(buckets& dst) const
{
BOOST_ASSERT(this->buckets_ && !dst.buckets_);
@ -544,8 +544,8 @@ namespace boost { namespace unordered_detail {
//
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
std::size_t hash_table<H, P, A, G, K>::count(key_type const& k) const
template <class H, class P, class A, class G, class E>
std::size_t hash_table<H, P, A, G, E>::count(key_type const& k) const
{
if(!this->size_) return 0;
node_ptr it = find_iterator(k); // throws, strong
@ -555,9 +555,9 @@ namespace boost { namespace unordered_detail {
// find
//
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::iterator_base
hash_table<H, P, A, G, K>::find(key_type const& k) const
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::iterator_base
hash_table<H, P, A, G, E>::find(key_type const& k) const
{
if(!this->size_) return this->end();
@ -570,9 +570,9 @@ namespace boost { namespace unordered_detail {
return this->end();
}
template <class H, class P, class A, class G, class K>
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME A::value_type&
hash_table<H, P, A, G, K>::at(key_type const& k) const
hash_table<H, P, A, G, E>::at(key_type const& k) const
{
if(!this->size_)
throw std::out_of_range("Unable to find key in unordered_map.");
@ -589,9 +589,9 @@ namespace boost { namespace unordered_detail {
// equal_range
//
// strong exception safety, no side effects
template <class H, class P, class A, class G, class K>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::iterator_pair
hash_table<H, P, A, G, K>::equal_range(key_type const& k) const
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::iterator_pair
hash_table<H, P, A, G, E>::equal_range(key_type const& k) const
{
if(!this->size_)
return iterator_pair(this->end(), this->end());
@ -612,8 +612,8 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Erase methods
template <class H, class P, class A, class G, class K>
void hash_table<H, P, A, G, K>::clear()
template <class H, class P, class A, class G, class E>
void hash_table<H, P, A, G, E>::clear()
{
if(!this->size_) return;
@ -626,8 +626,8 @@ namespace boost { namespace unordered_detail {
this->cached_begin_bucket_ = end;
}
template <class H, class P, class A, class G, class K>
inline std::size_t hash_table<H, P, A, G, K>::erase_group(
template <class H, class P, class A, class G, class E>
inline std::size_t hash_table<H, P, A, G, E>::erase_group(
node_ptr* it, bucket_ptr bucket)
{
node_ptr pos = *it;
@ -639,8 +639,8 @@ namespace boost { namespace unordered_detail {
return count;
}
template <class H, class P, class A, class G, class K>
std::size_t hash_table<H, P, A, G, K>::erase_key(key_type const& k)
template <class H, class P, class A, class G, class E>
std::size_t hash_table<H, P, A, G, E>::erase_key(key_type const& k)
{
if(!this->size_) return 0;
@ -653,9 +653,9 @@ namespace boost { namespace unordered_detail {
}
template <class H, class P, class A, class G, class K>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::iterator_base
hash_table<H, P, A, G, K>::erase(iterator_base r)
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::iterator_base
hash_table<H, P, A, G, E>::erase(iterator_base r)
{
BOOST_ASSERT(r.node_);
iterator_base next = r;
@ -668,9 +668,9 @@ namespace boost { namespace unordered_detail {
return next;
}
template <class H, class P, class A, class G, class K>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::iterator_base
hash_table<H, P, A, G, K>::erase_range(
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::iterator_base
hash_table<H, P, A, G, E>::erase_range(
iterator_base r1, iterator_base r2)
{
if(r1 != r2)
@ -713,9 +713,9 @@ namespace boost { namespace unordered_detail {
return r2;
}
template <class H, class P, class A, class G, class K>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, K>::iterator_base
hash_table<H, P, A, G, K>::emplace_empty_impl_with_node(
template <class H, class P, class A, class G, class E>
BOOST_DEDUCED_TYPENAME hash_table<H, P, A, G, E>::iterator_base
hash_table<H, P, A, G, E>::emplace_empty_impl_with_node(
node_constructor& a, std::size_t size)
{
key_type const& k = get_key(a.value());

View File

@ -15,9 +15,9 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Equality
template <class H, class P, class A, class K>
bool hash_unique_table<H, P, A, K>
::equals(hash_unique_table<H, P, A, K> const& other) const
template <class H, class P, class A, class E>
bool hash_unique_table<H, P, A, E>
::equals(hash_unique_table<H, P, A, E> const& other) const
{
if(this->size_ != other.size_) return false;
if(!this->size_) return true;
@ -43,9 +43,9 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// A convenience method for adding nodes.
template <class H, class P, class A, class K>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::node_ptr
hash_unique_table<H, P, A, K>::add_node(node_constructor& a,
template <class H, class P, class A, class E>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::node_ptr
hash_unique_table<H, P, A, E>::add_node(node_constructor& a,
bucket_ptr bucket)
{
node_ptr n = a.release();
@ -61,9 +61,9 @@ namespace boost { namespace unordered_detail {
// if hash function throws, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::value_type&
hash_unique_table<H, P, A, K>::operator[](key_type const& k)
template <class H, class P, class A, class E>
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::value_type&
hash_unique_table<H, P, A, E>::operator[](key_type const& k)
{
typedef BOOST_DEDUCED_TYPENAME value_type::second_type mapped_type;
@ -100,9 +100,9 @@ namespace boost { namespace unordered_detail {
}
}
template <class H, class P, class A, class K>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace_impl_with_node(node_constructor& a)
template <class H, class P, class A, class E>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace_impl_with_node(node_constructor& a)
{
// No side effects in this initial code
key_type const& k = this->get_key(a.value());
@ -129,10 +129,10 @@ namespace boost { namespace unordered_detail {
#if defined(BOOST_UNORDERED_STD_FORWARD)
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template<class... Args>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace_impl(key_type const& k,
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace_impl(key_type const& k,
Args&&... args)
{
// No side effects in this initial code
@ -166,10 +166,10 @@ namespace boost { namespace unordered_detail {
}
}
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template<class... Args>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace_impl(no_key, Args&&... args)
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace_impl(no_key, Args&&... args)
{
// Construct the node regardless - in order to get the key.
// It will be discarded if it isn't used
@ -178,10 +178,10 @@ namespace boost { namespace unordered_detail {
return emplace_impl_with_node(a);
}
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template<class... Args>
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace_empty_impl(Args&&... args)
inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace_empty_impl(Args&&... args)
{
node_constructor a(*this);
a.construct(std::forward<Args>(args)...);
@ -191,11 +191,11 @@ namespace boost { namespace unordered_detail {
#else
#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \
template <class H, class P, class A, class K> \
template <class H, class P, class A, class E> \
template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \
inline BOOST_DEDUCED_TYPENAME \
hash_unique_table<H, P, A, K>::emplace_return \
hash_unique_table<H, P, A, K>::emplace_impl( \
hash_unique_table<H, P, A, E>::emplace_return \
hash_unique_table<H, P, A, E>::emplace_impl( \
key_type const& k, \
BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \
{ \
@ -218,11 +218,11 @@ namespace boost { namespace unordered_detail {
} \
} \
\
template <class H, class P, class A, class K> \
template <class H, class P, class A, class E> \
template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \
inline BOOST_DEDUCED_TYPENAME \
hash_unique_table<H, P, A, K>::emplace_return \
hash_unique_table<H, P, A, K>:: \
hash_unique_table<H, P, A, E>::emplace_return \
hash_unique_table<H, P, A, E>:: \
emplace_impl(no_key, \
BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \
{ \
@ -231,11 +231,11 @@ namespace boost { namespace unordered_detail {
return emplace_impl_with_node(a); \
} \
\
template <class H, class P, class A, class K> \
template <class H, class P, class A, class E> \
template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \
inline BOOST_DEDUCED_TYPENAME \
hash_unique_table<H, P, A, K>::emplace_return \
hash_unique_table<H, P, A, K>:: \
hash_unique_table<H, P, A, E>::emplace_return \
hash_unique_table<H, P, A, E>:: \
emplace_empty_impl( \
BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \
{ \
@ -259,10 +259,10 @@ namespace boost { namespace unordered_detail {
// if hash function throws, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template<class... Args>
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace(Args&&... args)
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace(Args&&... args)
{
return this->size_ ?
emplace_impl(
@ -273,10 +273,10 @@ namespace boost { namespace unordered_detail {
#else
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class Arg0>
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return
hash_unique_table<H, P, A, K>::emplace(Arg0 const& arg0)
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return
hash_unique_table<H, P, A, E>::emplace(Arg0 const& arg0)
{
return this->size_ ?
emplace_impl(extractor::extract(arg0), arg0) :
@ -284,10 +284,10 @@ namespace boost { namespace unordered_detail {
}
#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \
template <class H, class P, class A, class K> \
template <class H, class P, class A, class E> \
template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::emplace_return \
hash_unique_table<H, P, A, K>::emplace( \
BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, E>::emplace_return \
hash_unique_table<H, P, A, E>::emplace( \
BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \
{ \
return this->size_ ? \
@ -307,9 +307,9 @@ namespace boost { namespace unordered_detail {
////////////////////////////////////////////////////////////////////////////
// Insert range methods
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class InputIt>
inline void hash_unique_table<H, P, A, K>::insert_range_impl(
inline void hash_unique_table<H, P, A, E>::insert_range_impl(
key_type const&, InputIt i, InputIt j)
{
node_constructor a(*this);
@ -352,9 +352,9 @@ namespace boost { namespace unordered_detail {
} while(++i != j);
}
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class InputIt>
inline void hash_unique_table<H, P, A, K>::insert_range_impl(
inline void hash_unique_table<H, P, A, E>::insert_range_impl(
no_key, InputIt i, InputIt j)
{
node_constructor a(*this);
@ -375,9 +375,9 @@ namespace boost { namespace unordered_detail {
// if hash function throws, or inserting > 1 element, basic exception safety
// strong otherwise
template <class H, class P, class A, class K>
template <class H, class P, class A, class E>
template <class InputIt>
void hash_unique_table<H, P, A, K>::insert_range(InputIt i, InputIt j)
void hash_unique_table<H, P, A, E>::insert_range(InputIt i, InputIt j)
{
if(i != j)
return insert_range_impl(extractor::extract(*i), i, j);