Changeset 44614


Ignore:
Timestamp:
Apr 20, 2008, 12:10:56 PM (10 years ago)
Author:
Daniel James
Message:

Merge in fix for the swap tests, and rename allocator.

Merged revisions 44512-44515,44517-44536 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk

................

r44512 | danieljames | 2008-04-17 20:03:00 +0100 (Thu, 17 Apr 2008) | 11 lines


Rename allocator.hpp.

................

r44536 | danieljames | 2008-04-18 11:27:50 +0100 (Fri, 18 Apr 2008) | 1 line


Check that hash_table_impl::swap isn't swapping with itself - which is causing the buffered functions to be set with the same value twice, resulting in an assertion.

................

Location:
trunk
Files:
1 deleted
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/boost/unordered/detail/hash_table.hpp

    r44489 r44614  
    2525#include <boost/assert.hpp>
    2626#include <boost/static_assert.hpp>
    27 #include <boost/unordered/detail/allocator.hpp>
     27#include <boost/unordered/detail/allocator_helpers.hpp>
    2828#include <boost/type_traits/is_same.hpp>
    2929#include <boost/mpl/if.hpp>
  • trunk/boost/unordered/detail/hash_table_impl.hpp

    r44489 r44614  
    695695
    696696                split_group(end.node_);
    697            
     697
    698698                link_ptr ptr(base->next_);
    699699                base->next_ = end.node_;
     
    11481148            // Swap's behaviour when allocators aren't equal is in dispute, for
    11491149            // details see:
    1150             // 
     1150            //
    11511151            // http://unordered.nfshost.com/doc/html/unordered/rationale.html#swapping_containers_with_unequal_allocators
    11521152            //
     
    11601160            void swap(BOOST_UNORDERED_TABLE& x)
    11611161            {
     1162                // The swap code can work when swapping a container with itself
     1163                // but it triggers an assertion in buffered_functions.
     1164                // At the moment, I'd rather leave that assertion in and add a
     1165                // check here, rather than remove the assertion. I might change
     1166                // this at a later date.
     1167                if(this == &x) return;
     1168
    11621169                // These can throw, but they only affect the function objects
    11631170                // that aren't in use so it is strongly exception safe, via.
     
    16701677                bucket_ptr bucket = data_.bucket_from_hash(hash_value);
    16711678                link_ptr pos = find_iterator(bucket, k);
    1672                
     1679
    16731680                if (BOOST_UNORDERED_BORLAND_BOOL(pos)) {
    16741681                    // Found an existing key, return it (no throw).
     
    17451752                    bucket_ptr bucket = data_.bucket_from_hash(hash_value);
    17461753                    link_ptr pos = find_iterator(bucket, extract_key(*i));
    1747                    
     1754
    17481755                    if (!BOOST_UNORDERED_BORLAND_BOOL(pos)) {
    17491756                        // Doesn't already exist, add to bucket.
     
    18721879
    18731880        // Iterators
    1874        
     1881
    18751882        template <typename Alloc> class BOOST_UNORDERED_ITERATOR;
    18761883        template <typename Alloc> class BOOST_UNORDERED_CONST_ITERATOR;
Note: See TracChangeset for help on using the changeset viewer.