Less use of the ampersand operator in unordered.

[SVN r66557]
This commit is contained in:
Daniel James
2010-11-13 12:31:54 +00:00
parent 2c1a8894cb
commit 14e0e1afc2
4 changed files with 31 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ namespace boost { namespace unordered_detail {
inline void hash_buckets<A, G>::delete_node(node_ptr b)
{
node* raw_ptr = static_cast<node*>(&*b);
boost::unordered_detail::destroy(&raw_ptr->value());
boost::unordered_detail::destroy(raw_ptr->value_ptr());
real_node_ptr n(node_alloc().address(*raw_ptr));
node_alloc().destroy(n);
node_alloc().deallocate(n, 1);

View File

@@ -231,6 +231,9 @@ namespace boost { namespace unordered_detail {
value_type& value() {
return *(ValueType*) this;
}
value_type* value_ptr() {
return (ValueType*) this;
}
private:
value_base& operator=(value_base const&);
};
@@ -249,6 +252,9 @@ namespace boost { namespace unordered_detail {
static value_type& get_value(node_ptr p) {
return static_cast<hash_node&>(*p).value();
}
static value_type* get_value_ptr(node_ptr p) {
return static_cast<hash_node&>(*p).value_ptr();
}
private:
hash_node& operator=(hash_node const&);
};
@@ -719,7 +725,7 @@ namespace boost { namespace unordered_detail {
return node::get_value(ptr_);
}
value_type* operator->() const {
return &node::get_value(ptr_);
return node::get_value_ptr(ptr_);
}
hash_local_iterator& operator++() {
ptr_ = ptr_->next_; return *this;
@@ -769,7 +775,7 @@ namespace boost { namespace unordered_detail {
return node::get_value(ptr_);
}
value_type const* operator->() const {
return &node::get_value(ptr_);
return node::get_value_ptr(ptr_);
}
hash_const_local_iterator& operator++() {
ptr_ = ptr_->next_; return *this;

View File

@@ -299,7 +299,7 @@ namespace boost { namespace unordered_detail {
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { hash_node<Alloc, Grouped> x; };
#endif
boost::unordered_detail::destroy(&node_->value());
boost::unordered_detail::destroy(node_->value_ptr());
}
if (node_constructed_)
@@ -322,7 +322,7 @@ namespace boost { namespace unordered_detail {
}
else {
BOOST_ASSERT(node_constructed_ && value_constructed_);
boost::unordered_detail::destroy(&node_->value());
boost::unordered_detail::destroy(node_->value_ptr());
value_constructed_ = false;
}
}