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.
................


[SVN r44614]
This commit is contained in:
Daniel James
2008-04-20 12:10:56 +00:00
parent 9689f844f4
commit 1c8ff48a21
3 changed files with 13 additions and 6 deletions

View File

@@ -24,7 +24,7 @@
#include <boost/limits.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/unordered/detail/allocator.hpp>
#include <boost/unordered/detail/allocator_helpers.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>

View File

@@ -1159,6 +1159,13 @@ namespace boost {
void swap(BOOST_UNORDERED_TABLE& x)
{
// The swap code can work when swapping a container with itself
// but it triggers an assertion in buffered_functions.
// At the moment, I'd rather leave that assertion in and add a
// check here, rather than remove the assertion. I might change
// this at a later date.
if(this == &x) return;
// These can throw, but they only affect the function objects
// that aren't in use so it is strongly exception safe, via.
// double buffering.