Merge in some minor changes.

Merged revisions 42157-42182 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/dev

........
  r42157 | danieljames | 2007-12-18 23:26:06 +0000 (Tue, 18 Dec 2007) | 1 line
  
  Tweak the function specifiers a tad bit.
........
  r42158 | danieljames | 2007-12-18 23:30:52 +0000 (Tue, 18 Dec 2007) | 1 line
  
  No need to create a node_constructor for every iteration.
........
  r42159 | danieljames | 2007-12-18 23:50:29 +0000 (Tue, 18 Dec 2007) | 1 line
  
  Pull another node_constructor out of a loop.
........
  r42172 | danieljames | 2007-12-19 17:51:41 +0000 (Wed, 19 Dec 2007) | 1 line
  
  Remove unrequired include.
........
  r42181 | danieljames | 2007-12-19 22:37:34 +0000 (Wed, 19 Dec 2007) | 2 lines
  
  Move the unordered library into 'branches' now that it has been accepted.
........
  r42182 | danieljames | 2007-12-19 22:39:54 +0000 (Wed, 19 Dec 2007) | 4 lines
  
  Actually, there are some things in the unordered code that aren't ready for
  trunk, so I'll rename the branch and create another one to be added to trunk
  later.
........



[SVN r42190]
This commit is contained in:
Daniel James 2007-12-19 23:28:19 +00:00
parent fdd7d6bbfb
commit ae23b79065
2 changed files with 13 additions and 15 deletions

View File

@ -238,40 +238,40 @@ namespace boost {
// Methods for navigating groups of elements with equal keys.
#if BOOST_UNORDERED_HASH_EQUIVALENT
static link_ptr& prev_in_group(link_ptr n) {
static inline link_ptr& prev_in_group(link_ptr n) {
return static_cast<node&>(*n).group_prev_;
}
// pre: Must be pointing to the first node in a group.
static link_ptr last_in_group(link_ptr n) {
static inline link_ptr last_in_group(link_ptr n) {
BOOST_ASSERT(BOOST_HASH_BORLAND_BOOL(n) && n != prev_in_group(n)->next_);
return prev_in_group(n);
}
// pre: Must be pointing to the first node in a group.
static link_ptr& next_group(link_ptr n) {
static inline link_ptr& next_group(link_ptr n) {
BOOST_ASSERT(BOOST_HASH_BORLAND_BOOL(n) && n != prev_in_group(n)->next_);
return prev_in_group(n)->next_;
}
#else
static link_ptr last_in_group(link_ptr n) {
static inline link_ptr last_in_group(link_ptr n) {
return n;
}
static link_ptr& next_group(link_ptr n) {
static inline link_ptr& next_group(link_ptr n) {
BOOST_ASSERT(n);
return n->next_;
}
#endif
// pre: Must be pointing to a node
static node& get_node(link_ptr p) {
static inline node& get_node(link_ptr p) {
BOOST_ASSERT(p);
return static_cast<node&>(*p);
}
// pre: Must be pointing to a node
static reference get_value(link_ptr p) {
static inline reference get_value(link_ptr p) {
BOOST_ASSERT(p);
return static_cast<node&>(*p).value_;
}
@ -481,7 +481,7 @@ namespace boost {
}
#if BOOST_UNORDERED_HASH_EQUIVALENT
size_type group_count(link_ptr it) const
static size_type group_count(link_ptr it)
{
size_type count = 0;
link_ptr first = it;
@ -492,7 +492,7 @@ namespace boost {
return count;
}
#else
size_type group_count(link_ptr) const
static size_type group_count(link_ptr)
{
return 1;
}
@ -1568,9 +1568,9 @@ namespace boost {
else {
// Only require basic exception safety here
reserve_extra(size() + distance);
node_constructor a(this->allocators_);
for (; i != j; ++i) {
node_constructor a(this->allocators_);
a.construct(*i);
key_type const& k = extract_key(a.get()->value_);
@ -1725,8 +1725,8 @@ namespace boost {
template <typename InputIterator>
void insert(InputIterator i, InputIterator j)
{
// If only inserting 1 element, get the required
// safety since insert is only called once.
node_constructor a(this->allocators_);
for (; i != j; ++i) {
// No side effects in this initial code
size_type hash_value = hash_function()(extract_key(*i));
@ -1740,7 +1740,6 @@ namespace boost {
// Create the node before rehashing in case it throws an
// exception (need strong safety in such a case).
node_constructor a(this->allocators_);
value_type const& v = *i;
a.construct(v);
@ -1790,7 +1789,7 @@ namespace boost {
size_type count(key_type const& k) const
{
link_ptr it = find_iterator(k); // throws, strong
return BOOST_HASH_BORLAND_BOOL(it) ? this->group_count(it) : 0;
return BOOST_HASH_BORLAND_BOOL(it) ? data::group_count(it) : 0;
}
// find

View File

@ -7,7 +7,6 @@
#define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
#include <boost/iterator_adaptors.hpp>
#include <boost/shared_ptr.hpp>
namespace test
{