|
Boost-Commit : |
From: igaztanaga_at_[hidden]
Date: 2008-06-21 05:06:17
Author: igaztanaga
Date: 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
New Revision: 46573
URL: http://svn.boost.org/trac/boost/changeset/46573
Log:
gcc 4.3 fixes for normal and -std=c++0x modes
Text files modified:
trunk/libs/intrusive/doc/intrusive.qbk | 100 +++++++++++++++++++++++++++++++--------
trunk/libs/intrusive/proj/vc7ide/Intrusive.sln | 8 +++
trunk/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj | 9 +++
trunk/libs/intrusive/proj/vc7ide/list/list.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/multiset/multiset.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/perf_test/perf_test.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/set/set.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/slist/slist.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/to-do.txt | 43 +++++++++++++---
trunk/libs/intrusive/proj/vc7ide/unordered_multiset/unordered_multiset.vcproj | 10 ----
trunk/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj | 10 ----
trunk/libs/intrusive/test/common_functors.hpp | 8 +++
trunk/libs/intrusive/test/list_test.cpp | 1
trunk/libs/intrusive/test/slist_test.cpp | 2
trunk/libs/intrusive/test/unordered_multiset_test.cpp | 48 ++++++++++++------
trunk/libs/intrusive/test/unordered_set_test.cpp | 48 ++++++++++++------
16 files changed, 201 insertions(+), 136 deletions(-)
Modified: trunk/libs/intrusive/doc/intrusive.qbk
==============================================================================
--- trunk/libs/intrusive/doc/intrusive.qbk (original)
+++ trunk/libs/intrusive/doc/intrusive.qbk 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -127,7 +127,7 @@
[section:properties_of_intrusive Properties of Boost.Intrusive containers]
-Semantically, a [*Boost.Intrusive] container is similar to an STL container
+Semantically, a [*Boost.Intrusive] container is similar to a STL container
holding pointers to objects. That is, if you have an intrusive list holding
objects of type `T`, then `std::list<T*>` would allow you to do quite the
same operations (maintaining and navigating a set of objects of type T and
@@ -584,7 +584,7 @@
safe state and intrusive containers check that state before inserting a value in the
container. When erasing an element from the container, the container puts the hook
in the safe state again. This allows a safer use mode and it can be used to detect
- programming errors. It implies an slight performance overhead in some operations
+ programming errors. It implies a slight performance overhead in some operations
and can convert some constant time operations to linear time operations.
* [*Auto-unlink hooks]: The hook destructor removes the object from the container
@@ -596,7 +596,7 @@
be configured to use any type of pointer. This configuration information is also
transmitted to the containers, so all the internal pointers used by intrusive containers
configured with these hooks will be smart pointers. As an example,
- [*Boost.Interprocess] defines an smart pointer compatible with shared memory,
+ [*Boost.Interprocess] defines an mart pointer compatible with shared memory,
called `offset_ptr`. [*Boost.Intrusive] can be configured to use this smart pointer
to allow shared memory intrusive containers.
@@ -718,7 +718,7 @@
As explained, [*Boost.Intrusive] auto-unlink hooks are incompatible with containers
that have constant-time `size()`, so if you try to define such container with an
-auto-unlink hook's value_traits, you will get an static assertion:
+auto-unlink hook's value_traits, you will get a static assertion:
[c++]
@@ -860,7 +860,7 @@
[section:slist_example Example]
-Now let's see an small example using both hooks:
+Now let's see a small example using both hooks:
[import ../example/doc_slist.cpp]
[doc_slist_code]
@@ -946,7 +946,7 @@
[section:list_example Example]
-Now let's see an small example using both hooks:
+Now let's see a small example using both hooks:
[import ../example/doc_list.cpp]
[doc_list_code]
@@ -1075,7 +1075,7 @@
[section:set_multiset_example Example]
-Now let's see an small example using both hooks and both containers:
+Now let's see a small example using both hooks and both containers:
[import ../example/doc_set.cpp]
[doc_set_code]
@@ -1277,11 +1277,22 @@
of the first element. This imposes the overhead of one pointer to the size
of the container. Default: `cache_begin<false>`.
+* [*`compare_hash<bool Enabled>`]:
+ [*Note: this option requires `store_hash<true>` option in the hook].
+ When the comparison function is expensive,
+ (e.g. strings with a long common predicate) sometimes (specially when the
+ load factor is high or we have many equivalent elements in an
+ [classref boost::intrusive::unordered_multiset unordered_multiset] and
+ no `optimize_multikey<>` is activatedin the hook)
+ the equality function is a performance problem. Two equal values must have
+ equal hashes, so comparing the hash values of two elements before using the
+ comparison functor can speed up some implementations.
+
[endsect]
[section:unordered_set_unordered_multiset_example Example]
-Now let's see an small example using both hooks and both containers:
+Now let's see a small example using both hooks and both containers:
[import ../example/doc_unordered_set.cpp]
[doc_unordered_set_code]
@@ -1450,9 +1461,9 @@
[classref boost::intrusive::sg_set sg_set] and
[classref boost::intrusive::sg_multiset sg_multiset]. A programmer
might prefer using a binary search tree hook so that the same type
-can be inserted in some situations in an splay container but
+can be inserted in some situations in a splay container but
also inserted in other compatible containers when
-the hook is not being used in an splay container.
+the hook is not being used in a splay container.
[classref boost::intrusive::bs_set_base_hook bs_set_base_hook] and
[classref boost::intrusive::bs_set_base_hook bs_set_member_hook] admit
@@ -1462,7 +1473,7 @@
[section:splay_set_multiset_example Example]
-Now let's see an small example using both splay hooks,
+Now let's see a small example using both splay hooks,
binary search tree hooks and
[classref boost::intrusive::splay_set splay_set]/
[classref boost::intrusive::splay_multiset splay_multiset]
@@ -1590,7 +1601,7 @@
[section:avl_set_multiset_example Example]
-Now let's see an small example using both hooks and
+Now let's see a small example using both hooks and
[classref boost::intrusive::avl_set avl_set]/
[classref boost::intrusive::avl_multiset avl_multiset]
containers:
@@ -1745,7 +1756,7 @@
[section:sg_set_multiset_example Example]
-Now let's see an small example using both hooks and
+Now let's see a small example using both hooks and
[classref boost::intrusive::sg_set sg_set]/
[classref boost::intrusive::sg_multiset sg_multiset]
containers:
@@ -1923,7 +1934,7 @@
Note that the disposing function does not need to just destroy the object. It can
implement any other operation like inserting the remove object in another container.
-Let's see an small example:
+Let's see a small example:
[import ../example/doc_erasing_and_disposing.cpp]
[doc_erasing_and_disposing]
@@ -1940,11 +1951,11 @@
As previously mentioned, [*Boost.Intrusive] containers are [*non-copyable and non-assignable], because
intrusive containers don't allocate memory at all. To implement a copy-constructor or assignment operator,
the user must clone one by one all the elements of the container and insert them in another intrusive container.
-However, cloning by hand is usually more inefficient than a member cloning function and an specialized cloning
+However, cloning by hand is usually more inefficient than a member cloning function and a specialized cloning
function can offer more guarantees than the manual cloning (better exception safety guarantees, for example).
To ease the implementation of copy constructors and assignment operators of classes containing [*Boost.Intrusive]
-containers, all [*Boost.Intrusive] containers offer an special cloning function called `clone_from`.
+containers, all [*Boost.Intrusive] containers offer a special cloning function called `clone_from`.
Apart from the container to be cloned, `clone_from` takes two function objects as arguments. For example, consider the
`clone_from` member function of [classref boost::intrusive::list list]:
@@ -1981,9 +1992,9 @@
[section:using_smart_pointers Using smart pointers with Boost.Intrusive containers]
[*Boost.Intrusive] hooks can be configured to use other pointers than raw pointers.
-When a [*Boost.Intrusive] hook is configured with an smart pointer as an argument,
+When a [*Boost.Intrusive] hook is configured with a smart pointer as an argument,
this pointer configuration is passed to the containers. For example, if the following
-hook is configured with an smart pointer (for example, an offset pointer from
+hook is configured with a smart pointer (for example, an offset pointer from
[*Boost.Interprocess]):
[import ../example/doc_offset_ptr.cpp]
@@ -2060,7 +2071,7 @@
if the programmer uses hooks provided by [*Boost.Intrusive], those functions
will be available.
-Let's see an small function that shows the use of `iterator_to` and
+Let's see a small function that shows the use of `iterator_to` and
`local_iterator_to`:
[import ../example/doc_iterator_from_value.cpp]
@@ -2068,6 +2079,51 @@
[endsect]
+[section:any_hooks Any Hooks: A single hook for any Intrusive container]
+
+Sometimes, a class programmer wants to place a class in several intrusive
+containers but no at the same time. In this case, the programmer might
+decide to insert two hooks in the same class.
+
+[c++]
+
+ class MyClass
+ : public list_base_hook<>, public slist_base_hook<> //...
+ {};
+
+However, there is a more size-efficient alternative in [*Boost.Intrusive]: "any" hooks
+([classref boost::intrusive::any_base_hook any_base_hook] and
+[classref boost::intrusive::any_member_hook any_member_hook].
+These hooks can be used to store a type in several containers
+offered by [*Boost.Intrusive] minimizing the size of the class.
+
+These hooks support these options:
+
+* [*`tag<class Tag>`] (for base hooks only): This argument serves as a tag,
+ so you can derive from more than one slist hook.
+ Default: `tag<default_tag>`.
+
+* [*`link_mode<link_mode_type LinkMode>`]: The linking policy.
+ `link_mode<auto_unlink>` is [*not] supported and `link_mode<safe_mode>`
+ might offer weaker error detection in any hooks than in other hooks.
+ Default: `link_mode<safe_link>`.
+
+* [*`void_pointer<class VoidPointer>`]: The pointer type to be used
+ internally in the hook and propagated to the container.
+ Default: `void_pointer<void*>`.
+
+`auto_unlink` can't be supported because the hook does not know in which type of might
+be inserted container. Additionally, these hooks don't support `unlink()` and
+`swap_nodes()` operations for the same reason.
+
+Here's an example that creates a class with two any hooks, and uses one to insert the
+class in a [classref slist] and the other one in a [classref list].
+
+[import ../example/doc_any_hook.cpp]
+[doc_any_hook]
+
+[endsect]
+
[section:concepts Concepts explained]
This section will expand the explanation of previously presented basic concepts
@@ -2187,7 +2243,7 @@
int value_;
};
-* [*Intrusive Container]: A container that offers an STL-like interface to store
+* [*Intrusive Container]: A container that offers a STL-like interface to store
user objects. An intrusive container can be templatized to store different
value types that use different hooks. An intrusive container is also more elaborate
than a group of nodes: it can store the number of elements to achieve constant-time
@@ -2642,7 +2698,7 @@
Instead of using [*Boost.Intrusive] predefined hooks
a user might want to develop customized containers, for example, using nodes that are
-optimized for an specific
+optimized for a specific
application or that are compatible with a a legacy ABI. A user might want
to have only two additional pointers in his class and insert the class in a doubly
linked list sometimes and in a singly linked list in other situations. You can't
@@ -2804,7 +2860,7 @@
to have several `ValueTraits` defining the same `node_traits` type (and thus, the same `node_traits::node`).
This reduces the number of node algorithm instantiations, but
now `ValueTraits::to_node_ptr` and `ValueTraits::to_value_ptr` functions need to offer
-conversions between both types. Let's see an small example:
+conversions between both types. Let's see a small example:
First, we'll define the node to be used in the algorithms. For a linked list,
we just need a node that stores two pointers:
Modified: trunk/libs/intrusive/proj/vc7ide/Intrusive.sln
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/Intrusive.sln (original)
+++ trunk/libs/intrusive/proj/vc7ide/Intrusive.sln 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -79,6 +79,10 @@
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "any_hook", "any_test\any_test.vcproj", "{97B61B24-4C97-9681-50BF-243175A813B6}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -167,6 +171,10 @@
{1690A9E7-DB57-971C-F24A-09B752A942F7}.Debug.Build.0 = Debug|Win32
{1690A9E7-DB57-971C-F24A-09B752A942F7}.Release.ActiveCfg = Release|Win32
{1690A9E7-DB57-971C-F24A-09B752A942F7}.Release.Build.0 = Release|Win32
+ {97B61B24-4C97-9681-50BF-243175A813B6}.Debug.ActiveCfg = Debug|Win32
+ {97B61B24-4C97-9681-50BF-243175A813B6}.Debug.Build.0 = Debug|Win32
+ {97B61B24-4C97-9681-50BF-243175A813B6}.Release.ActiveCfg = Release|Win32
+ {97B61B24-4C97-9681-50BF-243175A813B6}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Modified: trunk/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -106,6 +106,9 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
+ RelativePath="..\..\..\..\..\boost\intrusive\any_hook.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\intrusive\avl_set.hpp">
</File>
<File
@@ -208,6 +211,9 @@
Name="detail"
Filter="">
<File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\any_node_and_algorithms.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\intrusive\detail\assert.hpp">
</File>
<File
@@ -317,6 +323,9 @@
RelativePath="..\..\..\example\doc_advanced_value_traits2.cpp">
</File>
<File
+ RelativePath="..\..\..\example\doc_any_hook.cpp">
+ </File>
+ <File
RelativePath="..\..\..\example\doc_assoc_optimized_code.cpp">
</File>
<File
Modified: trunk/libs/intrusive/proj/vc7ide/list/list.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/list/list.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/list/list.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -127,16 +127,6 @@
RelativePath="..\..\..\test\list_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/multiset/multiset.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/multiset/multiset.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/multiset/multiset.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -121,16 +121,6 @@
RelativePath="..\..\..\test\multiset_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/perf_test/perf_test.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/perf_test/perf_test.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/perf_test/perf_test.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -122,16 +122,6 @@
RelativePath="..\..\..\perf\perf_list.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{68B017A6-F80D6A2-084c-06A6-8A323C1ABD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/set/set.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/set/set.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/set/set.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -121,16 +121,6 @@
RelativePath="..\..\..\test\set_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{68007AB6-FDA6800-084c-B78A-8121AA3BBD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/slist/slist.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/slist/slist.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/slist/slist.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -121,16 +121,6 @@
RelativePath="..\..\..\test\slist_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/to-do.txt
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/to-do.txt (original)
+++ trunk/libs/intrusive/proj/vc7ide/to-do.txt 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -1,12 +1,37 @@
-Add resize() to list
-Implement incremental hashing
-Add invariants to slist and test them after every operation
-Create a generic hook that will work with all containers
-Take advantage of store_hash in lookups: Instead of comparing objects, just
- compare hashes. This will improve equality for expensive objects.
+Implement incremental hashing:
-Improve the use of cache_begin to unordered containers:
--> Speed up rehash
+bucket_len is power of two
+cur_idx is always at least, half of bucket_len
+
+find bucket from value:
+ size_type bucket_num = hash(val) &(bucket_len - 1);
+ if (bucket_num >= cur_idx)
+ bucket_num -= bucket_len/2;
+
+incremental_rehash:
+
+ iterator _Plist, _Where;
+ if (load_factor > LoadFactorLimit)
+ { // too dense, need to grow hash table
+ if (cur_idx >= (bucket_len - 1))
+ { // table full, request doubling
+ return false;
+ }
+ else if (cur_idx >= bucket_len)
+ bucket_len*=2;
+
+ size_type bucket_num = cur_idx - bucket_len/2;
+ // rehash elements from bucket_num
+ ++cur_idx;
+ }
+
+insert from value:
+
+ size_type bucket_num = hash(val) & (bucket_len - 1);
+ if (bucket_num >= cur_idx)
+ bucket_num -= bucket_len/2;
+ insert in bucket
+
+rehash:
-Add erase(iterator, iterator, difference_type) to lists to obtain constant-time erase.
Modified: trunk/libs/intrusive/proj/vc7ide/unordered_multiset/unordered_multiset.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/unordered_multiset/unordered_multiset.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/unordered_multiset/unordered_multiset.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -122,16 +122,6 @@
RelativePath="..\..\..\test\unordered_multiset_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{99954380-9C8D-084c-4b04-62E52E6FBBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{6A181B76-FDA6800-8E8B-0A66-813A3BB1AD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj
==============================================================================
--- trunk/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj (original)
+++ trunk/libs/intrusive/proj/vc7ide/unordered_set/unordered_set.vcproj 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -121,16 +121,6 @@
RelativePath="..\..\..\test\unordered_set_test.cpp">
</File>
</Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{68AB0076-FDA6800-084c-06A6-8121AA3BBD01}">
- </Filter>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/intrusive/test/common_functors.hpp
==============================================================================
--- trunk/libs/intrusive/test/common_functors.hpp (original)
+++ trunk/libs/intrusive/test/common_functors.hpp 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -41,6 +41,14 @@
{ return new T(t); }
};
+template<class T>
+class new_default_factory
+{
+ public:
+ T *operator()()
+ { return new T(); }
+};
+
} //namespace test {
} //namespace intrusive {
} //namespace boost {
Modified: trunk/libs/intrusive/test/list_test.cpp
==============================================================================
--- trunk/libs/intrusive/test/list_test.cpp (original)
+++ trunk/libs/intrusive/test/list_test.cpp 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -229,6 +229,7 @@
TEST_INTRUSIVE_SEQUENCE( init_values, const_testlist.begin() ); }
}
+
template<class ValueTraits>
void test_list<ValueTraits>
::test_shift(std::vector<typename ValueTraits::value_type>& values)
Modified: trunk/libs/intrusive/test/slist_test.cpp
==============================================================================
--- trunk/libs/intrusive/test/slist_test.cpp (original)
+++ trunk/libs/intrusive/test/slist_test.cpp 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -315,7 +315,7 @@
testlist.erase (++testlist.begin(), testlist.end());
BOOST_TEST (testlist.size() == 1);
BOOST_TEST (testlist.front().value_ == 3);
-}
+}
template<class ValueTraits, bool Linear, bool CacheLast>
void test_slist<ValueTraits, Linear, CacheLast>
Modified: trunk/libs/intrusive/test/unordered_multiset_test.cpp
==============================================================================
--- trunk/libs/intrusive/test/unordered_multiset_test.cpp (original)
+++ trunk/libs/intrusive/test/unordered_multiset_test.cpp 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -27,7 +27,7 @@
static const std::size_t BucketSize = 11;
-template<class ValueTraits, bool CacheBegin>
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
struct test_unordered_multiset
{
typedef typename ValueTraits::value_type value_type;
@@ -41,8 +41,8 @@
static void test_clone(std::vector<value_type>& values);
};
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_all (std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_all (std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -50,6 +50,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
{
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -77,8 +78,8 @@
}
//test case due to an error in tree implementation:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_impl()
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_impl()
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -86,6 +87,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -108,8 +110,8 @@
}
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_sort(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_sort(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -117,6 +119,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -130,8 +133,8 @@
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_insert(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_insert(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -139,6 +142,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
typedef typename unordered_multiset_type::iterator iterator;
@@ -269,8 +273,8 @@
}
//test: insert (seq-version), swap, erase (seq-version), size:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_swap(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_swap(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -278,6 +282,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
typename unordered_multiset_type::bucket_type buckets [BucketSize];
@@ -302,8 +307,8 @@
}
//test: rehash:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -311,6 +316,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -347,8 +353,8 @@
}
//test: find, equal_range (lower_bound, upper_bound):
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>::test_find(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>::test_find(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_multiset
@@ -356,6 +362,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
@@ -380,8 +387,8 @@
}
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_multiset<ValueTraits, CacheBegin>
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash>
::test_clone(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
@@ -390,6 +397,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_multiset_type;
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
{
@@ -462,6 +470,7 @@
, typename value_type::unordered_set_base_hook_t
>::type
, true
+ , false
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -472,6 +481,7 @@
>
>::type
, false
+ , false
>::test_all(data);
return 0;
@@ -495,6 +505,7 @@
, typename value_type::unordered_set_base_hook_t
>::type
, true
+ , false
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -505,6 +516,7 @@
>
>::type
, false
+ , false
>::test_all(data);
test_unordered_multiset < typename detail::get_base_value_traits
@@ -512,6 +524,7 @@
, typename value_type::unordered_set_auto_base_hook_t
>::type
, true
+ , true
>::test_all(data);
test_unordered_multiset < typename detail::get_member_value_traits
@@ -522,6 +535,7 @@
>
>::type
, false
+ , true
>::test_all(data);
return 0;
}
Modified: trunk/libs/intrusive/test/unordered_set_test.cpp
==============================================================================
--- trunk/libs/intrusive/test/unordered_set_test.cpp (original)
+++ trunk/libs/intrusive/test/unordered_set_test.cpp 2008-06-21 05:06:15 EDT (Sat, 21 Jun 2008)
@@ -26,7 +26,7 @@
static const std::size_t BucketSize = 11;
-template<class ValueTraits, bool CacheBegin>
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
struct test_unordered_set
{
typedef typename ValueTraits::value_type value_type;
@@ -40,8 +40,8 @@
static void test_clone(std::vector<value_type>& values);
};
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_all(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_all(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -49,6 +49,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
{
@@ -76,8 +77,8 @@
}
//test case due to an error in tree implementation:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_impl()
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_impl()
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -85,6 +86,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -105,8 +107,8 @@
}
//test: constructor, iterator, clear, reverse_iterator, front, back, size:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_sort(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_sort(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -114,6 +116,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -129,8 +132,8 @@
}
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_insert(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_insert(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -138,6 +141,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -165,8 +169,8 @@
}
//test: insert (seq-version), swap, erase (seq-version), size:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_swap(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_swap(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -174,6 +178,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -197,8 +202,8 @@
}
//test: rehash:
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_rehash(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -206,6 +211,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -243,8 +249,8 @@
//test: find, equal_range (lower_bound, upper_bound):
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>::test_find(std::vector<typename ValueTraits::value_type>& values)
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>::test_find(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
typedef unordered_set
@@ -252,6 +258,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
@@ -274,8 +281,8 @@
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
-template<class ValueTraits, bool CacheBegin>
-void test_unordered_set<ValueTraits, CacheBegin>
+template<class ValueTraits, bool CacheBegin, bool CompareHash>
+void test_unordered_set<ValueTraits, CacheBegin, CompareHash>
::test_clone(std::vector<typename ValueTraits::value_type>& values)
{
typedef typename ValueTraits::value_type value_type;
@@ -284,6 +291,7 @@
, value_traits<ValueTraits>
, constant_time_size<value_type::constant_time_size>
, cache_begin<CacheBegin>
+ , compare_hash<CompareHash>
> unordered_set_type;
typedef typename unordered_set_type::bucket_traits bucket_traits;
{
@@ -356,6 +364,7 @@
, typename value_type::unordered_set_base_hook_t
>::type
, true
+ , false
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
< value_type
@@ -365,6 +374,7 @@
>
>::type
, false
+ , false
>::test_all(data);
return 0;
@@ -388,6 +398,7 @@
, typename value_type::unordered_set_base_hook_t
>::type
, true
+ , false
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
@@ -398,6 +409,7 @@
>
>::type
, false
+ , false
>::test_all(data);
test_unordered_set < typename detail::get_base_value_traits
@@ -405,6 +417,7 @@
, typename value_type::unordered_set_auto_base_hook_t
>::type
, true
+ , true
>::test_all(data);
test_unordered_set < typename detail::get_member_value_traits
@@ -415,6 +428,7 @@
>
>::type
, false
+ , true
>::test_all(data);
return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk