Merged missed changes for 1.47 release

[SVN r73278]
This commit is contained in:
Ion Gaztañaga
2011-07-21 17:42:55 +00:00
parent 4a99aa7f6b
commit 8a4edc41fe
5 changed files with 149 additions and 92 deletions

View File

@@ -3831,6 +3831,23 @@ all the objects to be inserted in intrusive containers in containers like `std::
[section:release_notes Release Notes]
[section:release_notes_boost_1_47_00 Boost 1.47 Release]
* Fixed bugs
[@https://svn.boost.org/trac/boost/ticket/4797 #4797],
[@https://svn.boost.org/trac/boost/ticket/5165 #5165],
[@https://svn.boost.org/trac/boost/ticket/5183 #5183],
[@https://svn.boost.org/trac/boost/ticket/5191 #5191].
[endsect]
[section:release_notes_boost_1_46_00 Boost 1.46 Release]
* Fixed bug
[@https://svn.boost.org/trac/boost/ticket/4980 #4980],
[endsect]
[section:release_notes_boost_1_45_00 Boost 1.45 Release]
* Added `function_hook` option.

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2009
// (C) Copyright Ion Gaztanaga 2006-2011
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -51,7 +51,7 @@ class shared_memory_data
#include <boost/interprocess/allocators/allocator.hpp>
//Definition of the shared memory friendly intrusive list
typedef ip::list<shared_memory_data> shm_list_t;
typedef list<shared_memory_data> intrusive_list_t;
int main()
{
@@ -80,12 +80,14 @@ int main()
for(int i = 0; i < MaxElem; ++i) (*pshm_vect)[i].set(i);
//Now create the shared memory intrusive list
shm_list_t *plist = shm.construct<shm_list_t>(ip::anonymous_instance)();
intrusive_list_t *plist = shm.construct<intrusive_list_t>(ip::anonymous_instance)();
//Insert objects stored in shared memory vector in the intrusive list
plist->insert(plist->end(), pshm_vect->begin(), pshm_vect->end());
//Check all the inserted nodes
int checker = 0;
for( shm_list_t::const_iterator it = plist->begin(), itend(plist->end())
for( intrusive_list_t::const_iterator it = plist->begin(), itend(plist->end())
; it != itend; ++it, ++checker){
if(it->get() != checker) return false;
}

View File

@@ -291,8 +291,6 @@
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\workaround.hpp">
</File>
</Filter>
</Filter>
<Filter
Name="doc"
Filter="">
@@ -303,6 +301,8 @@
RelativePath="..\..\..\doc\Jamfile.v2">
</File>
</Filter>
</Filter>
</Filter>
<Filter
Name="Test headers"
Filter="">

View File

@@ -15,3 +15,15 @@
-> Document incremental<> option better
-> Assure stable order for optimize_multikey and inverse order otherwise
-> add an option to unordered containers to get O(1) traversal and begin()/end() even with very low load factors
The article explains it quite well: Linear Hashing The cost of hash table expansion is spread out across each hash table insertion operation, as opposed to being incurred all at once. Linear hashing is therefore well suited for interactive applications.
Linear hashing typically requires power of two length for bucket arrays, but those buckets are not fully used from the beginning, as it is when using non-linear hashing (which typically requires prime bucket length). Although the bucket array hash, say, has 16 buckets, the implementation uses first just one or two, then when after incremental rehashing uses three, etc.. incrementally, until it fills those 16 buckets. Then for a new incremental rehash, it allocates a new bucket array with length 32, but starts using only 17, and continues with incremental hashing. I think Dinkum STL used this incremental rehashing. The key is that in each incremental hashing, not all elements are rehashed, but just elements of a single bucket, distributing hashing impact in all allocations.
For more information on hashing alternatives see the original standard hashing container proposal (chapter Control of Hash Resizing):
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1456.html
Now, intrusive containers don't allocate memory at all, so incremental rehashing must be trigered by the user using
"incremental_rehash(bool)" (use an additional bucket, that is, incremental rehash) and "incremental_rehash(bucket_traits)" (to update the new bucket array with an array that should be twice/half the size of the previous one). I admit that this is not explained at all with an example, so I will note this issue in my to do list.

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-2009
// (C) Copyright Ion Gaztanaga 2007-2011
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +15,7 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -78,7 +79,7 @@ template< class Container, class Data >
void test_sequence_container(Container & c, Data & d)
{
assert( d.size() > 2 );
{
c.clear();
BOOST_TEST( c.size() == 0 );
@@ -127,6 +128,18 @@ void test_sequence_container(Container & c, Data & d)
BOOST_TEST( c.size() == 0 );
BOOST_TEST( c.empty() );
}
{
c.clear();
c.insert( c.begin(), d.begin(), d.end() );
Container move_c(::boost::move(c));
BOOST_TEST( move_c.size() == d.size() );
BOOST_TEST( c.empty());
c = ::boost::move(move_c);
BOOST_TEST( c.size() == d.size() );
BOOST_TEST( move_c.empty());
}
}
template< class Container, class Data >
@@ -212,9 +225,8 @@ void test_common_unordered_and_associative_container(Container & c, Data & d, bo
template< class Container, class Data >
void test_common_unordered_and_associative_container(Container & c, Data & d)
{
{
typedef typename Container::size_type size_type;
{
assert( d.size() > 2 );
c.clear();
@@ -233,7 +245,7 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
c.erase(*da);
BOOST_TEST( c.size() == old_size-1 );
//This should not eras anyone
//This should erase nothing
size_type second_erase = c.erase_and_dispose( *da, detail::null_disposer() );
BOOST_TEST( second_erase == 0 );
@@ -244,10 +256,24 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
BOOST_TEST( c.find(*db) != c.end() );
BOOST_TEST( c.equal_range(*db).first != c.end() );
BOOST_TEST( c.equal_range(*da).first == c.equal_range(*da).second );
}
{
c.clear();
c.insert( d.begin(), d.end() );
size_type orig_size = c.size();
Container move_c(::boost::move(c));
BOOST_TEST(orig_size == move_c.size());
BOOST_TEST( c.empty());
for( typename Data::const_iterator di = d.begin(), de = d.end();
di != de; ++di )
{ BOOST_TEST( move_c.find(*di) != move_c.end() ); }
BOOST_TEST( c.equal_range(*da).first == c.end() );
c = ::boost::move(move_c);
for( typename Data::const_iterator di = d.begin(), de = d.end();
di != de; ++di )
{ BOOST_TEST( c.find(*di) != c.end() ); }
BOOST_TEST( move_c.empty());
}
typedef detail::bool_<is_unordered<Container>::value> enabler;
test_common_unordered_and_associative_container(c, d, enabler());