summaryrefslogtreecommitdiff
path: root/libs/intrusive
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-04-08 03:09:47 +0000
committer <>2015-05-05 14:37:32 +0000
commitf2541bb90af059680aa7036f315f052175999355 (patch)
treea5b214744b256f07e1dc2bd7273035a7808c659f /libs/intrusive
parented232fdd34968697a68783b3195b1da4226915b5 (diff)
downloadboost-tarball-master.tar.gz
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_58_0.tar.bz2.HEADboost_1_58_0master
Diffstat (limited to 'libs/intrusive')
-rw-r--r--libs/intrusive/doc/intrusive.qbk21
-rw-r--r--libs/intrusive/example/doc_avl_set.cpp2
-rw-r--r--libs/intrusive/example/doc_offset_ptr.cpp1
-rw-r--r--libs/intrusive/example/doc_positional_insertion.cpp2
-rw-r--r--libs/intrusive/example/doc_set.cpp2
-rw-r--r--libs/intrusive/example/doc_sg_set.cpp2
-rw-r--r--libs/intrusive/example/doc_splay_set.cpp2
-rw-r--r--libs/intrusive/example/doc_treap_set.cpp2
-rw-r--r--libs/intrusive/example/doc_unordered_set.cpp2
-rw-r--r--libs/intrusive/proj/vc7ide/Intrusive.sln8
-rw-r--r--libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj21
-rw-r--r--libs/intrusive/proj/vc7ide/pointer_traits/pointer_traits.vcproj1
-rw-r--r--libs/intrusive/test/bounded_pointer.hpp19
-rw-r--r--libs/intrusive/test/common_functors.hpp2
-rw-r--r--libs/intrusive/test/default_hook_test.cpp2
-rw-r--r--libs/intrusive/test/generic_assoc_test.hpp17
-rw-r--r--libs/intrusive/test/generic_multiset_test.hpp15
-rw-r--r--libs/intrusive/test/generic_set_test.hpp15
-rw-r--r--libs/intrusive/test/has_member_function_callable_with.cpp552
-rw-r--r--libs/intrusive/test/itestvalue.hpp26
-rw-r--r--libs/intrusive/test/list_test.cpp9
-rw-r--r--libs/intrusive/test/nonhook_node.hpp2
-rw-r--r--libs/intrusive/test/null_iterator_test.cpp2
-rw-r--r--libs/intrusive/test/pointer_traits_test.cpp103
-rw-r--r--libs/intrusive/test/smart_ptr.hpp20
-rw-r--r--libs/intrusive/test/test_container.hpp5
-rw-r--r--libs/intrusive/test/unordered_multiset_test.cpp8
-rw-r--r--libs/intrusive/test/unordered_set_test.cpp5
28 files changed, 324 insertions, 544 deletions
diff --git a/libs/intrusive/doc/intrusive.qbk b/libs/intrusive/doc/intrusive.qbk
index dcf97d318..4fac20735 100644
--- a/libs/intrusive/doc/intrusive.qbk
+++ b/libs/intrusive/doc/intrusive.qbk
@@ -1527,7 +1527,7 @@ guarantees, this caching effect is not updated when const versions of
search functions like `find()`, `lower_bound()`, `upper_bound()`, `equal_range()`,
`count()`... are called. This means that using splay-tree based associative containers as drop-in
replacements of [classref boost::intrusive::set set]/
-[classref boost::intrusive::multiset multiset], specially for const search functions,
+[classref boost::intrusive::multiset multiset], specially for const search functions,
might not result in desired performance improvements.
If element searches are randomized, the tree will be continuously srebalanced
@@ -1577,7 +1577,7 @@ And they also can receive an additional option:
[section:splay_set_multiset_example Example]
-Now let's see a small example using
+Now let's see a small example using
[classref boost::intrusive::splay_set splay_set]/
[classref boost::intrusive::splay_multiset splay_multiset]
containers:
@@ -3261,8 +3261,8 @@ Thus [*Boost.Intrusive] offers its own `SCARY iterator` implementation, where it
change when the container is configured with an option that does not alter the value <-> node transformation.
More concretely, the following options and conditions guarantee that iterator types are unchanged:
-* [*All containers]: `size_type<>`, `constant_time_size<>`,
-* [*`slist`]: `cache_last<>`, `linear<>`,
+* [*All containers]: `size_type<>`, `constant_time_size<>`,
+* [*`slist`]: `cache_last<>`, `linear<>`,
* [*`unordered_[multi]set`]: `hash<>`, `equal<>`, `power_2_buckets<>`, `cache_begin<>`.
* [*All tree-like containers] (`[multi]set`, `avl_[multi]set`, `sg_[multi]set`, `bs_[multi]set`,
`splay_[multi]set`, `treap_[multi]set`): `compare<>`.
@@ -3752,7 +3752,7 @@ The disperse list is again the slowest.
Intrusive containers can offer performance benefits that cannot be achieved with
equivalent non-intrusive containers. Memory locality improvements are noticeable
when the objects to be inserted are small. Minimizing memory allocation/deallocation calls is also
-an important factor and intrusive containers make this simple if all objects
+an important factor and intrusive containers make this simple if all objects
to be inserted in intrusive containers are allocated using `std::vector` or `std::deque`.
[endsect]
@@ -3761,6 +3761,17 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std
[section:release_notes Release Notes]
+[section:release_notes_boost_1_58_00 Boost 1.58 Release]
+
+* Reduced compile-time dependencies, headers, and the use of Boost.Preprocessor, specially for hooks and iterators.
+* Fixed bugs:
+ * [@https://svn.boost.org/trac/boost/ticket/6720 Boost Trac #6720: ['intrusive::unordered_set::clear_and_dispose does not compile on VC11 Beta when passed a stateless lambda]]
+ * [@https://svn.boost.org/trac/boost/ticket/10771 Boost Trac #10771: ['remove_if is broken for slist]]
+ * [@https://svn.boost.org/trac/boost/ticket/10853 Boost Trac #10853: ['problem with detection of const_cast_from]]
+ * [@https://svn.boost.org/trac/boost/ticket/10987 Boost Trac #10987: ['bug in any_xxx_node_traits, returning by reference]]
+
+[endsect]
+
[section:release_notes_boost_1_57_00 Boost 1.57 Release]
* Experimental version of node checkers, contributed by Matei David. Many thanks!
diff --git a/libs/intrusive/example/doc_avl_set.cpp b/libs/intrusive/example/doc_avl_set.cpp
index 561298c40..ae6768917 100644
--- a/libs/intrusive/example/doc_avl_set.cpp
+++ b/libs/intrusive/example/doc_avl_set.cpp
@@ -12,7 +12,7 @@
//[doc_avl_set_code
#include <boost/intrusive/avl_set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <cassert>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_offset_ptr.cpp b/libs/intrusive/example/doc_offset_ptr.cpp
index 9d8381681..2e1906f47 100644
--- a/libs/intrusive/example/doc_offset_ptr.cpp
+++ b/libs/intrusive/example/doc_offset_ptr.cpp
@@ -59,7 +59,6 @@ class shared_memory_data
//[doc_offset_ptr_1
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/vector.hpp>
-#include <boost/interprocess/containers/list.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
//Definition of the shared memory friendly intrusive list
diff --git a/libs/intrusive/example/doc_positional_insertion.cpp b/libs/intrusive/example/doc_positional_insertion.cpp
index c851fbd22..5d628a0eb 100644
--- a/libs/intrusive/example/doc_positional_insertion.cpp
+++ b/libs/intrusive/example/doc_positional_insertion.cpp
@@ -12,7 +12,7 @@
//[doc_positional_insertion
#include <boost/intrusive/set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <cassert>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_set.cpp b/libs/intrusive/example/doc_set.cpp
index a759e51ec..dae81abc7 100644
--- a/libs/intrusive/example/doc_set.cpp
+++ b/libs/intrusive/example/doc_set.cpp
@@ -12,7 +12,7 @@
//[doc_set_code
#include <boost/intrusive/set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <cassert>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_sg_set.cpp b/libs/intrusive/example/doc_sg_set.cpp
index 576dbc747..4920a76f3 100644
--- a/libs/intrusive/example/doc_sg_set.cpp
+++ b/libs/intrusive/example/doc_sg_set.cpp
@@ -12,7 +12,7 @@
//[doc_sg_set_code
#include <boost/intrusive/sg_set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <cassert>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_splay_set.cpp b/libs/intrusive/example/doc_splay_set.cpp
index 6c333b761..831fa03be 100644
--- a/libs/intrusive/example/doc_splay_set.cpp
+++ b/libs/intrusive/example/doc_splay_set.cpp
@@ -12,7 +12,7 @@
//[doc_splay_set_code
#include <boost/intrusive/splay_set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_treap_set.cpp b/libs/intrusive/example/doc_treap_set.cpp
index e82cedec5..f8abbe585 100644
--- a/libs/intrusive/example/doc_treap_set.cpp
+++ b/libs/intrusive/example/doc_treap_set.cpp
@@ -12,7 +12,7 @@
//[doc_treap_set_code
#include <boost/intrusive/treap_set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <cassert>
using namespace boost::intrusive;
diff --git a/libs/intrusive/example/doc_unordered_set.cpp b/libs/intrusive/example/doc_unordered_set.cpp
index 5468026df..ca0b5be31 100644
--- a/libs/intrusive/example/doc_unordered_set.cpp
+++ b/libs/intrusive/example/doc_unordered_set.cpp
@@ -12,7 +12,7 @@
//[doc_unordered_set_code
#include <boost/intrusive/unordered_set.hpp>
#include <vector>
-#include <algorithm>
+#include <functional>
#include <boost/functional/hash.hpp>
using namespace boost::intrusive;
diff --git a/libs/intrusive/proj/vc7ide/Intrusive.sln b/libs/intrusive/proj/vc7ide/Intrusive.sln
index 03b1e1792..8ef1fc3be 100644
--- a/libs/intrusive/proj/vc7ide/Intrusive.sln
+++ b/libs/intrusive/proj/vc7ide/Intrusive.sln
@@ -127,6 +127,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "null_iterator", "null_itera
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_test", "..\..\..\container\proj\vc7ide\map_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -263,6 +267,10 @@ Global
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Debug.Build.0 = Debug|Win32
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Release.ActiveCfg = Release|Win32
{32A79B10-B2A0-C1B8-9458-9456152413B5}.Release.Build.0 = Release|Win32
+ {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
+ {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
+ {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
+ {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
diff --git a/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj b/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj
index d5bcd6f60..d8b924c7c 100644
--- a/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj
+++ b/libs/intrusive/proj/vc7ide/_intrusivelib/_intrusivelib.vcproj
@@ -233,6 +233,9 @@
RelativePath="..\..\..\..\..\boost\intrusive\detail\algo_type.hpp">
</File>
<File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\algorithm.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\intrusive\detail\any_node_and_algorithms.hpp">
</File>
<File
@@ -242,6 +245,12 @@
RelativePath="..\..\..\..\..\boost\intrusive\detail\assert.hpp">
</File>
<File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\avltree_node.hpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\bstree_algorithms_base.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\intrusive\detail\common_slist_algorithms.hpp">
</File>
<File
@@ -290,6 +299,9 @@
RelativePath="..\..\..\..\..\boost\intrusive\detail\is_stateful_value_traits.hpp">
</File>
<File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\iterator.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\..\boost\intrusive\detail\key_nodeptr_comp.hpp">
</File>
<File
@@ -302,7 +314,10 @@
RelativePath="..\..\..\..\..\boost\intrusive\detail\math.hpp">
</File>
<File
- RelativePath="..\..\..\..\..\boost\intrusive\detail\memory_util.hpp">
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\minimal_less_equal_header.hpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\minimal_pair_header.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\mpl.hpp">
@@ -323,10 +338,10 @@
RelativePath="..\..\..\..\..\boost\intrusive\detail\pointer_element.hpp">
</File>
<File
- RelativePath="..\..\..\..\..\boost\intrusive\detail\preprocessor.hpp">
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\rbtree_node.hpp">
</File>
<File
- RelativePath="..\..\..\..\..\boost\intrusive\detail\rbtree_node.hpp">
+ RelativePath="..\..\..\..\..\boost\intrusive\detail\reverse_iterator.hpp">
</File>
<File
RelativePath="..\..\..\..\..\boost\intrusive\detail\simple_disposers.hpp">
diff --git a/libs/intrusive/proj/vc7ide/pointer_traits/pointer_traits.vcproj b/libs/intrusive/proj/vc7ide/pointer_traits/pointer_traits.vcproj
index 1ad31b788..d77caf98a 100644
--- a/libs/intrusive/proj/vc7ide/pointer_traits/pointer_traits.vcproj
+++ b/libs/intrusive/proj/vc7ide/pointer_traits/pointer_traits.vcproj
@@ -30,6 +30,7 @@
DisableLanguageExtensions="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
diff --git a/libs/intrusive/test/bounded_pointer.hpp b/libs/intrusive/test/bounded_pointer.hpp
index 485930082..b6d568ac9 100644
--- a/libs/intrusive/test/bounded_pointer.hpp
+++ b/libs/intrusive/test/bounded_pointer.hpp
@@ -20,6 +20,7 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/core/no_exceptions_support.hpp>
+#include <boost/move/adl_move_swap.hpp>
template < typename T >
class bounded_pointer;
@@ -67,10 +68,10 @@ class bounded_pointer
operator= (const bounded_pointer<T2> & other)
{ m_offset = other.m_offset; return *this; }
- const bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >& unconst() const
- { return *reinterpret_cast< const bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >* >(this); }
+ const bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >& unconst() const
+ { return *reinterpret_cast< const bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >* >(this); }
- bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >& unconst()
+ bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >& unconst()
{ return *reinterpret_cast< bounded_pointer< typename boost::intrusive::detail::remove_const< T >::type >* >(this); }
static mut_val_t* base()
@@ -150,7 +151,7 @@ class bounded_reference
bounded_reference()
: m_offset(max_offset)
{}
-
+
bounded_reference(const bounded_reference& other)
: m_offset(other.m_offset)
{}
@@ -190,7 +191,7 @@ class bounded_reference
// the copy asop is shallow; we need swap overload to shuffle a vector of references
friend void swap(bounded_reference& lhs, bounded_reference& rhs)
- { std::swap(lhs.m_offset, rhs.m_offset); }
+ { ::boost::adl_move_swap(lhs.m_offset, rhs.m_offset); }
private:
template <typename> friend class bounded_reference;
@@ -221,7 +222,7 @@ class bounded_allocator
m_in_use[p.m_offset] = true;
return p;
}
-
+
void deallocate(pointer p, size_t n)
{
assert(inited());
@@ -238,12 +239,12 @@ class bounded_allocator
// allocate non-constructed storage
m_base = static_cast< T* >(::operator new [] (max_offset * sizeof(T)));
}
-
+
static bool inited()
{
return m_in_use.size() == max_offset;
}
-
+
static bool is_clear()
{
assert(inited());
@@ -256,7 +257,7 @@ class bounded_allocator
}
return true;
}
-
+
static void destroy()
{
// deallocate storage without destructors
diff --git a/libs/intrusive/test/common_functors.hpp b/libs/intrusive/test/common_functors.hpp
index 7433d3801..f3cbb29db 100644
--- a/libs/intrusive/test/common_functors.hpp
+++ b/libs/intrusive/test/common_functors.hpp
@@ -13,7 +13,7 @@
#ifndef BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
#define BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
-#include<boost/intrusive/detail/iiterator.hpp>
+#include<boost/intrusive/detail/iterator.hpp>
#include<boost/intrusive/detail/mpl.hpp>
#include<boost/static_assert.hpp>
diff --git a/libs/intrusive/test/default_hook_test.cpp b/libs/intrusive/test/default_hook_test.cpp
index c7ef908ea..a8efa9946 100644
--- a/libs/intrusive/test/default_hook_test.cpp
+++ b/libs/intrusive/test/default_hook_test.cpp
@@ -78,7 +78,7 @@ int main()
//Create several MyClass objects, each one with a different value
std::vector<MyClass> values;
for(int i = 0; i < 100; ++i) values.push_back(MyClass(i));
-
+
{
List my_list;
Slist my_slist;
diff --git a/libs/intrusive/test/generic_assoc_test.hpp b/libs/intrusive/test/generic_assoc_test.hpp
index 9b3223c47..0107afe33 100644
--- a/libs/intrusive/test/generic_assoc_test.hpp
+++ b/libs/intrusive/test/generic_assoc_test.hpp
@@ -129,9 +129,9 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
typedef typename ValueTraits::value_type value_type;
//value_cont_type values;
- const int MaxValues = 100;
+ const std::size_t MaxValues = 200;
value_cont_type values(MaxValues);
- for(int i = 0; i != MaxValues; ++i){
+ for(std::size_t i = 0; i != MaxValues; ++i){
(&values[i])->value_ = i;
}
@@ -146,15 +146,16 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
{ //Ordered insertion + erasure
assoc_type testset (values.begin(), values.begin() + values.size());
TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin());
-
+ testset.check();
iterator it(testset.begin()), itend(testset.end());
- for(int i = 0; it != itend; ++i){
+ for(std::size_t i = 0; it != itend; ++i){
BOOST_TEST(&*it == &values[i]);
it = testset.erase(it);
+ testset.check();
}
BOOST_TEST(testset.empty());
}
-
+
{ //Now random insertions + erasure
assoc_type testset;
typedef typename value_cont_type::iterator vec_iterator;
@@ -165,14 +166,16 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
; ++it){
it_vector.push_back(it);
}
- for(int i = 0; i != MaxValues; ++i){
+ for(std::size_t i = 0; i != MaxValues; ++i){
testset.insert(*it_vector[i]);
+ testset.check();
}
TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin());
//Random erasure
std::random_shuffle(it_vector.begin(), it_vector.end());
- for(int i = 0; i != MaxValues; ++i){
+ for(std::size_t i = 0; i != MaxValues; ++i){
testset.erase(testset.iterator_to(*it_vector[i]));
+ testset.check();
}
BOOST_TEST(testset.empty());
}
diff --git a/libs/intrusive/test/generic_multiset_test.hpp b/libs/intrusive/test/generic_multiset_test.hpp
index 343dadda8..f7d9fd14b 100644
--- a/libs/intrusive/test/generic_multiset_test.hpp
+++ b/libs/intrusive/test/generic_multiset_test.hpp
@@ -15,6 +15,7 @@
#include "common_functors.hpp"
#include <boost/detail/lightweight_test.hpp>
#include <boost/intrusive/options.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
#include "test_macros.hpp"
#include "test_container.hpp"
#include "generic_assoc_test.hpp"
@@ -226,7 +227,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 2);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
(&cmp_val)->value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
@@ -246,7 +247,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
BOOST_TEST (range.first->value_ == 1);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 3);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -254,14 +255,14 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (const_range.first->value_ == 1);
BOOST_TEST (const_range.second->value_ == 2);
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
(&cmp_val_lower)->value_ = 1;
(&cmp_val_upper)->value_ = 3;
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (range.first->value_ == 1);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 3);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -269,7 +270,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
BOOST_TEST (const_range.first->value_ == 2);
BOOST_TEST (const_range.second->value_ == 3);
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 2);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 2);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -277,7 +278,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 2);
- BOOST_TEST (std::distance (range.first, range.second) == 0);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
}
{
(&cmp_val_lower)->value_ = 5;
@@ -285,7 +286,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (const_range.first->value_ == 5);
BOOST_TEST (const_range.second == const_testset.end());
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
}
}
}
diff --git a/libs/intrusive/test/generic_set_test.hpp b/libs/intrusive/test/generic_set_test.hpp
index ca137cfeb..8058149ce 100644
--- a/libs/intrusive/test/generic_set_test.hpp
+++ b/libs/intrusive/test/generic_set_test.hpp
@@ -15,6 +15,7 @@
#include "common_functors.hpp"
#include <boost/detail/lightweight_test.hpp>
#include <boost/intrusive/options.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
#include "test_macros.hpp"
#include "test_container.hpp"
#include "generic_assoc_test.hpp"
@@ -292,7 +293,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
(&cmp_val)->value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
@@ -314,7 +315,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
BOOST_TEST (range.first->value_ == 1);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 2);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -322,14 +323,14 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (const_range.first->value_ == 1);
BOOST_TEST (const_range.second->value_ == 2);
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
(&cmp_val_lower)->value_ = 1;
(&cmp_val_upper)->value_ = 3;
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (range.first->value_ == 1);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 2);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -337,7 +338,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
BOOST_TEST (const_range.first->value_ == 2);
BOOST_TEST (const_range.second->value_ == 3);
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
}
{
(&cmp_val_lower)->value_ = 1;
@@ -345,7 +346,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 2);
- BOOST_TEST (std::distance (range.first, range.second) == 0);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
}
{
(&cmp_val_lower)->value_ = 5;
@@ -353,7 +354,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
BOOST_TEST (const_range.first->value_ == 5);
BOOST_TEST (const_range.second == const_testset.end());
- BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
}
}
}
diff --git a/libs/intrusive/test/has_member_function_callable_with.cpp b/libs/intrusive/test/has_member_function_callable_with.cpp
index 9049c4444..41242a8be 100644
--- a/libs/intrusive/test/has_member_function_callable_with.cpp
+++ b/libs/intrusive/test/has_member_function_callable_with.cpp
@@ -1,370 +1,75 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2014. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-
-//Just for BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED
+//User define
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func0to3
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func0to3ns {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
-#include <cstddef>
-#include <boost/move/utility_core.hpp>
-
-namespace boost{
-namespace intrusive{
-namespace intrusive_detail{
-namespace has_member_function_callable_with {
-
-struct dont_care
-{
- dont_care(...);
-};
-
-template<class T>
-struct make_dontcare
-{
- typedef has_member_function_callable_with::dont_care type;
-};
-
-struct private_type
-{
- static private_type p;
- private_type const &operator,(int) const;
-};
-
-typedef char yes_type;
-struct no_type{ char dummy[2]; };
-
-template<typename T>
-no_type is_private_type(T const &);
-yes_type is_private_type(private_type const &);
-
-}}}}
-
-
-namespace boost{
-namespace intrusive{
-namespace intrusive_detail{
-
-template <typename Type>
-class has_member_function_named_func
-{
- struct BaseMixin
- {
- void func();
- };
-
- struct Base : public ::boost::intrusive::detail::remove_cv<Type>::type, public BaseMixin {};
- template <typename T, T t> class Helper{};
-
- template <typename U>
- static has_member_function_callable_with::no_type deduce
- (U*, Helper<void (BaseMixin::*)(), &U::func>* = 0);
- static has_member_function_callable_with::yes_type deduce(...);
-
- public:
- static const bool value =
- sizeof(has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0)));
-};
-
-}}}
-
-#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun, bool HasFunc
- , class P0 = void , class P1 = void , class P2 = void>
- struct has_member_function_callable_with_func_impl;
-
-
- template<typename Fun , class P0 , class P1 , class P2>
- struct has_member_function_callable_with_func_impl
- <Fun, false , P0 , P1 , P2>
- {
- static const bool value = false;
- };
-
-
- }}}
-
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- #if !defined(_MSC_VER) || (_MSC_VER < 1600)
-
- #if !defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
-
- template<class F, std::size_t N = sizeof(boost::move_detail::declval<F>().func(), 0)>
- struct zeroarg_checker_func
- {
- has_member_function_callable_with::yes_type dummy;
- zeroarg_checker_func(int);
- };
-
- //For buggy compilers like MSVC 7.1, ((F*)0)->func() does not
- //fail but sizeof yields to 0.
- template<class F>
- struct zeroarg_checker_func<F, 0>
- {
- has_member_function_callable_with::no_type dummy;
- zeroarg_checker_func(int);
- };
-
- template<typename Fun>
- struct has_member_function_callable_with_func_impl
- <Fun, true , void , void , void>
- {
- template<class U>
- static zeroarg_checker_func<U> Test(zeroarg_checker_func<U>*);
-
- template <class U>
- static has_member_function_callable_with::no_type Test(...);
-
- static const bool value
- = sizeof(Test< Fun >(0)) == sizeof(has_member_function_callable_with::yes_type);
- };
-
- #else
-
- template<typename Fun>
- struct has_member_function_callable_with_func_impl
- <Fun, true , void , void , void>
- {
- //GCC [3.4-4.3) gives ICE when instantiating the 0 arg version so it is not supported.
- static const bool value = true;
- };
-
- #endif
-
- #else
-
- template<typename Fun>
- struct has_member_function_callable_with_func_impl
- <Fun, true , void , void , void>
- {
- template<class U>
- static decltype(boost::move_detail::declval<U>().func(), has_member_function_callable_with::yes_type()) Test(U* f);
-
- template<class U>
- static has_member_function_callable_with::no_type Test(...);
- static const bool value = sizeof(Test<Fun>((Fun*)0)) == sizeof(has_member_function_callable_with::yes_type);
- };
-
- #endif
-
- }}}
-
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun , class P0>
- struct has_member_function_callable_with_func_impl
- <Fun, true , P0 , void , void>
- {
-
- struct FunWrap : Fun
- {
- using Fun::func;
- has_member_function_callable_with::private_type
- func( has_member_function_callable_with::dont_care) const;
- };
-
- static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
- sizeof(has_member_function_callable_with::is_private_type
- ( (::boost::move_detail::declval< FunWrap >().func( ::boost::move_detail::declval<P0>() ), 0) )
- )
- );
- };
-
- }}}
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun , class P0 , class P1>
- struct has_member_function_callable_with_func_impl
- <Fun, true , P0 , P1 , void>
- {
- struct FunWrap: Fun
- {
- using Fun::func;
- has_member_function_callable_with::private_type
- func( has_member_function_callable_with::dont_care , has_member_function_callable_with::dont_care) const;
- };
-
- static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
- sizeof(has_member_function_callable_with::is_private_type
- ( (::boost::move_detail::declval< FunWrap >().
- func( ::boost::move_detail::declval<P0>()
- , ::boost::move_detail::declval<P1>() )
- , 0) )
- )
- );
- };
- }}}
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun , class P0 , class P1 , class P2>
- struct has_member_function_callable_with_func_impl
- <Fun, true , P0 , P1 , P2 >
- {
- struct FunWrap: Fun
- {
- using Fun::func;
- has_member_function_callable_with::private_type
- func( has_member_function_callable_with::dont_care
- , has_member_function_callable_with::dont_care
- , has_member_function_callable_with::dont_care) const;
- };
-
- static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
- sizeof(has_member_function_callable_with::is_private_type
- ( (::boost::move_detail::declval< FunWrap >().
- func( ::boost::move_detail::declval<P0>()
- , ::boost::move_detail::declval<P1>()
- , ::boost::move_detail::declval<P2>() )
- , 0) )
- )
- );
- };
-
- template<typename Fun
- , class P0 = void , class P1 = void, typename P2 = void>
- struct has_member_function_callable_with_func
- : public has_member_function_callable_with_func_impl
- <Fun, has_member_function_named_func<Fun>::value, P0 , P1 , P2 >
- {};
- }}}
-
-#else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun, bool HasFunc, class ...Args>
- struct has_member_function_callable_with_func_impl;
-
- template<typename Fun, class ...Args>
- struct has_member_function_callable_with_func_impl
- <Fun, false, Args...>
- {
- static const bool value = false;
- };
-
-
- }}}
-
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- #ifdef BOOST_NO_CXX11_DECLTYPE
- template<class F, std::size_t N = sizeof(boost::move_detail::declval<F>().func(), 0)>
- struct zeroarg_checker_func
- {
- has_member_function_callable_with::yes_type dummy;
- zeroarg_checker_func(int);
- };
-
- //For buggy compilers like MSVC 7.1, ((F*)0)->func() does not
- //fail but sizeof yields to 0.
- template<class F>
- struct zeroarg_checker_func<F, 0>
- {
- has_member_function_callable_with::no_type dummy;
- zeroarg_checker_func(int);
- };
-
- #endif //BOOST_NO_CXX11_DECLTYPE
-
- template<typename Fun>
- struct has_member_function_callable_with_func_impl
- <Fun, true>
- {
- #ifndef BOOST_NO_CXX11_DECLTYPE
- template<class U, class V = decltype(boost::move_detail::declval<U>().func()) >
- static boost_intrusive_has_member_function_callable_with::yes_type Test(U*);
- #else
- template<class U>
- static zeroarg_checker_func<U> Test(zeroarg_checker_func<U>*);
- #endif
-
- template <class U>
- static has_member_function_callable_with::no_type Test(...);
-
- static const bool value = sizeof(Test< Fun >(0))
- == sizeof(has_member_function_callable_with::yes_type);
- };
-
- }}}
-
-
- namespace boost{
- namespace intrusive{
- namespace intrusive_detail{
-
- template<typename Fun, class ...Args>
- struct has_member_function_callable_with_func_impl
- <Fun, true , Args...>
- {
- template<class ...DontCares>
- struct FunWrapTmpl : Fun
- {
- using Fun::func;
- has_member_function_callable_with::private_type
- func(DontCares...) const;
- };
-
- typedef FunWrapTmpl<typename has_member_function_callable_with::make_dontcare<Args>::type...> FunWrap;
-
- static bool const value = (sizeof(has_member_function_callable_with::no_type) ==
- sizeof(has_member_function_callable_with::is_private_type
- ( (::boost::move_detail::declval< FunWrap >().func( ::boost::move_detail::declval<Args>()... ), 0) )
- )
- );
- };
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func1to2
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func1to2ns {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
+#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
- template<typename Fun, class ...Args>
- struct has_member_function_callable_with_func
- : public has_member_function_callable_with_func_impl
- <Fun, has_member_function_named_func<Fun>::value, Args... >
- {};
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func3to3
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func3to3ns {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
+#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
- }}}
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func0to0
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func0to0ns {
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
+#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
-#endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING)
+///////////////////
+///////////////////
+// TEST CODE
+///////////////////
+///////////////////
struct functor
{
- void func();
- void func(const int&);
- void func(const int&, const int&);
- void func(const int&, const int&, const int&);
+ //func0to3
+ void func0to3();
+ void func0to3(const int&);
+ void func0to3(const int&, const int&);
+ void func0to3(const int&, const int&, const int&);
+ //func1to2
+ void func1to2(const int&);
+ void func1to2(const int&, const int&);
+ //func3to3
+ void func3to3(const int&, const int&, const int&);
+ //func0to0
+ void func0to0();
};
struct functor2
{
- void func(char*);
- void func(int, char*);
- void func(int, char*, double);
- void func(const int&, char*, void *);
+ void func0to3(char*);
+ void func0to3(int, char*);
+ void func0to3(int, char*, double);
+ void func0to3(const int&, char*, void *);
+ //func1to2
+ void func1to2(char*);
+ void func1to2(int, char*);
+ void func1to2(int, char*, double);
+ //func3to3
+ void func3to3(const int&, char*, void *);
};
struct functor3
@@ -374,43 +79,55 @@ struct functor3
struct functor4
{
- void func(...);
- template<class T>
- void func(int, const T &);
-
- template<class T>
- void func(const T &);
-
- template<class T, class U>
- void func(int, const T &, const U &);
+ //func0to3
+ void func0to3(...);
+ template<class T> void func0to3(int, const T &);
+ template<class T> void func0to3(const T &);
+ template<class T, class U> void func0to3(int, const T &, const U &);
+ //func1to2
+ template<class T> void func1to2(int, const T &);
+ template<class T> void func1to2(const T &);
+ template<class T, class U> void func1to2(int, const T &, const U &);
+ //func3to3
+ void func3to3(...);
+ template<class T, class U> void func3to3(int, const T &, const U &);
};
int main()
{
- using namespace boost::intrusive::intrusive_detail;
-
#if !defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
- {
- int check1[ has_member_function_callable_with_func<functor>::value ? 1 : -1];
- int check2[!has_member_function_callable_with_func<functor2>::value ? 1 : -1];
- int check3[!has_member_function_callable_with_func<functor3>::value ? 1 : -1];
- int check4[ has_member_function_callable_with_func<functor4>::value ? 1 : -1];
+ { //func0to3 0 arg
+ using func0to3ns::has_member_function_callable_with_func0to3;
+ int check1[ has_member_function_callable_with_func0to3<functor>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func0to3<functor2>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func0to3<functor3>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func0to3<functor4>::value ? 1 : -1];
(void)check1;
(void)check2;
(void)check3;
(void)check4;
}
+ { //func0to0 0 arg
+ using func0to0ns::has_member_function_callable_with_func0to0;
+ int check1[ has_member_function_callable_with_func0to0<functor>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func0to0<functor2>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func0to0<functor3>::value ? 1 : -1];
+ (void)check1;
+ (void)check2;
+ (void)check3;
+ }
#endif
- {
- int check1[ has_member_function_callable_with_func<functor, int>::value ? 1 : -1];
- int check2[!has_member_function_callable_with_func<functor, char*>::value ? 1 : -1];
- int check3[!has_member_function_callable_with_func<functor2, int>::value ? 1 : -1];
- int check4[ has_member_function_callable_with_func<functor2, char*>::value ? 1 : -1];
- int check5[!has_member_function_callable_with_func<functor3, int>::value ? 1 : -1];
- int check6[!has_member_function_callable_with_func<functor3, char*>::value ? 1 : -1];
- int check7[ has_member_function_callable_with_func<functor4, int>::value ? 1 : -1];
- int check8[ has_member_function_callable_with_func<functor4, char*>::value ? 1 : -1];
+ { //func0to3 1arg
+ using func0to3ns::has_member_function_callable_with_func0to3;
+ int check1[ has_member_function_callable_with_func0to3<functor, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func0to3<functor, char*>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func0to3<functor2, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func0to3<functor2, char*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func0to3<functor3, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func0to3<functor3, char*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func0to3<functor4, int>::value ? 1 : -1];
+ int check8[ has_member_function_callable_with_func0to3<functor4, char*>::value ? 1 : -1];
(void)check1;
(void)check2;
(void)check3;
@@ -421,14 +138,16 @@ int main()
(void)check8;
}
- {
- int check1[ has_member_function_callable_with_func<functor, int, int>::value ? 1 : -1];
- int check2[!has_member_function_callable_with_func<functor, int, char*>::value ? 1 : -1];
- int check3[!has_member_function_callable_with_func<functor2, int, int>::value ? 1 : -1];
- int check4[ has_member_function_callable_with_func<functor2, int, char*>::value ? 1 : -1];
- int check5[!has_member_function_callable_with_func<functor3, int, int>::value ? 1 : -1];
- int check6[!has_member_function_callable_with_func<functor3, int, char*>::value ? 1 : -1];
- int check7[ has_member_function_callable_with_func<functor4, int, char*>::value ? 1 : -1];
+ { //func1to2 1arg
+ using func1to2ns::has_member_function_callable_with_func1to2;
+ int check1[ has_member_function_callable_with_func1to2<functor, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func1to2<functor, char*>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func1to2<functor2, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func1to2<functor2, char*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func1to2<functor3, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func1to2<functor3, char*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func1to2<functor4, int>::value ? 1 : -1];
+ int check8[ has_member_function_callable_with_func1to2<functor4, char*>::value ? 1 : -1];
(void)check1;
(void)check2;
(void)check3;
@@ -436,16 +155,18 @@ int main()
(void)check5;
(void)check6;
(void)check7;
+ (void)check8;
}
- {
- int check1[ has_member_function_callable_with_func<functor, int, int, int>::value ? 1 : -1];
- int check2[!has_member_function_callable_with_func<functor, int, char*, int>::value ? 1 : -1];
- int check3[!has_member_function_callable_with_func<functor2, int, int, int>::value ? 1 : -1];
- int check4[ has_member_function_callable_with_func<functor2, int, char*, void*>::value ? 1 : -1];
- int check5[!has_member_function_callable_with_func<functor3, int, int, int>::value ? 1 : -1];
- int check6[!has_member_function_callable_with_func<functor3, int, char*, void*>::value ? 1 : -1];
- int check7[ has_member_function_callable_with_func<functor4, int, char*, int>::value ? 1 : -1];
+ { //func0to3 2arg
+ using func0to3ns::has_member_function_callable_with_func0to3;
+ int check1[ has_member_function_callable_with_func0to3<functor, int, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func0to3<functor, int, char*>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func0to3<functor2, int, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func0to3<functor2, int, char*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func0to3<functor3, int, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func0to3<functor3, int, char*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func0to3<functor4, int, char*>::value ? 1 : -1];
(void)check1;
(void)check2;
(void)check3;
@@ -455,6 +176,59 @@ int main()
(void)check7;
}
- return 0;
+ { //func1to2 2arg
+ using func1to2ns::has_member_function_callable_with_func1to2;
+ int check1[ has_member_function_callable_with_func1to2<functor, int, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func1to2<functor, int, char*>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func1to2<functor2, int, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func1to2<functor2, int, char*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func1to2<functor3, int, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func1to2<functor3, int, char*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func1to2<functor4, int, char*>::value ? 1 : -1];
+ (void)check1;
+ (void)check2;
+ (void)check3;
+ (void)check4;
+ (void)check5;
+ (void)check6;
+ (void)check7;
+ }
+ { //func0to3 3arg
+ using func0to3ns::has_member_function_callable_with_func0to3;
+ int check1[ has_member_function_callable_with_func0to3<functor, int, int, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func0to3<functor, int, char*, int>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func0to3<functor2, int, int, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func0to3<functor2, int, char*, void*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func0to3<functor3, int, int, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func0to3<functor3, int, char*, void*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func0to3<functor4, int, char*, int>::value ? 1 : -1];
+ (void)check1;
+ (void)check2;
+ (void)check3;
+ (void)check4;
+ (void)check5;
+ (void)check6;
+ (void)check7;
+ }
+
+ { //func3to3 3arg
+ using func3to3ns::has_member_function_callable_with_func3to3;
+ int check1[ has_member_function_callable_with_func3to3<functor, int, int, int>::value ? 1 : -1];
+ int check2[!has_member_function_callable_with_func3to3<functor, int, char*, int>::value ? 1 : -1];
+ int check3[!has_member_function_callable_with_func3to3<functor2, int, int, int>::value ? 1 : -1];
+ int check4[ has_member_function_callable_with_func3to3<functor2, int, char*, void*>::value ? 1 : -1];
+ int check5[!has_member_function_callable_with_func3to3<functor3, int, int, int>::value ? 1 : -1];
+ int check6[!has_member_function_callable_with_func3to3<functor3, int, char*, void*>::value ? 1 : -1];
+ int check7[ has_member_function_callable_with_func3to3<functor4, int, char*, int>::value ? 1 : -1];
+ (void)check1;
+ (void)check2;
+ (void)check3;
+ (void)check4;
+ (void)check5;
+ (void)check6;
+ (void)check7;
+ }
+
+ return 0;
}
diff --git a/libs/intrusive/test/itestvalue.hpp b/libs/intrusive/test/itestvalue.hpp
index 793504044..b9efa56c2 100644
--- a/libs/intrusive/test/itestvalue.hpp
+++ b/libs/intrusive/test/itestvalue.hpp
@@ -197,32 +197,6 @@ class pointer_holder
T* const _ptr;
};
-/*
-struct int_testvalue_comp
-{
- template<class Hooks, bool constant_time_size>
- bool operator()
- (const testvalue<Hooks, constant_time_size>& v1, const int &i) const
- { return v1.value_ < i; }
- template<class Hooks, bool constant_time_size>
- bool operator()
- (const int &i, const testvalue<Hooks, constant_time_size>& v1) const
- { return i < v1.value_; }
-};
-
-struct int_testvalue_pcomp
-{
- template<class Hooks, bool constant_time_size>
- bool operator()
- (const testvalue<Hooks, constant_time_size>& v1, const int &i) const
- { return v1.value_ < i; }
- template<class Hooks, bool constant_time_size>
- bool operator()
- (const int &i, const testvalue<Hooks, constant_time_size>& v1) const
- { return i < v1.value_; }
-};
-*/
-
} //namespace boost{
} //namespace intrusive{
diff --git a/libs/intrusive/test/list_test.cpp b/libs/intrusive/test/list_test.cpp
index 31f2b392d..5476701da 100644
--- a/libs/intrusive/test/list_test.cpp
+++ b/libs/intrusive/test/list_test.cpp
@@ -1,4 +1,3 @@
-/*
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Olaf Krzikalla 2004-2006.
@@ -541,11 +540,3 @@ int main()
return boost::report_errors();
}
-*/
-
-#include <boost/intrusive/list_hook.hpp>
-
-int main()
-{
- return 0;
-} \ No newline at end of file
diff --git a/libs/intrusive/test/nonhook_node.hpp b/libs/intrusive/test/nonhook_node.hpp
index f862801b6..2127083d9 100644
--- a/libs/intrusive/test/nonhook_node.hpp
+++ b/libs/intrusive/test/nonhook_node.hpp
@@ -97,7 +97,7 @@ struct nonhook_node_member_value_traits
{
return pointer_traits<const_node_ptr>::pointer_to(static_cast<const node&>(value.*P));
}
-
+
static pointer to_value_ptr(node_ptr n)
{
return pointer_traits<pointer>::pointer_to
diff --git a/libs/intrusive/test/null_iterator_test.cpp b/libs/intrusive/test/null_iterator_test.cpp
index 72a68f225..1905a656c 100644
--- a/libs/intrusive/test/null_iterator_test.cpp
+++ b/libs/intrusive/test/null_iterator_test.cpp
@@ -16,7 +16,7 @@
#include <boost/intrusive/sg_set.hpp>
#include <boost/intrusive/treap_set.hpp>
#include <boost/intrusive/splay_set.hpp>
-#include <boost/intrusive/detail/memory_util.hpp>
+#include <boost/intrusive/detail/mpl.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/aligned_storage.hpp>
diff --git a/libs/intrusive/test/pointer_traits_test.cpp b/libs/intrusive/test/pointer_traits_test.cpp
index 8c70fcb3b..1455e8730 100644
--- a/libs/intrusive/test/pointer_traits_test.cpp
+++ b/libs/intrusive/test/pointer_traits_test.cpp
@@ -10,6 +10,28 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+struct CompleteSmartPtrStats
+{
+ static unsigned static_cast_called;
+ static unsigned dynamic_cast_called;
+ static unsigned const_cast_called;
+ static unsigned pointer_to_called;
+
+ static void reset_stats()
+ {
+ static_cast_called = 0;
+ dynamic_cast_called = 0;
+ const_cast_called = 0;
+ pointer_to_called = 0;
+ }
+};
+
+unsigned CompleteSmartPtrStats::static_cast_called= 0;
+unsigned CompleteSmartPtrStats::dynamic_cast_called = 0;
+unsigned CompleteSmartPtrStats::const_cast_called = 0;
+unsigned CompleteSmartPtrStats::pointer_to_called = 0;
template<class T>
class CompleteSmartPtr
@@ -18,7 +40,6 @@ class CompleteSmartPtr
friend class CompleteSmartPtr;
public:
-
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class U> using rebind = CompleteSmartPtr<U>;
#else
@@ -44,7 +65,7 @@ class CompleteSmartPtr
{ this->ptr_ = c.ptr_; }
static CompleteSmartPtr pointer_to(T &r)
- { return CompleteSmartPtr(r); }
+ { ++CompleteSmartPtrStats::pointer_to_called; return CompleteSmartPtr(r); }
T * operator->() const
{ return ptr_; }
@@ -54,15 +75,15 @@ class CompleteSmartPtr
template<class U>
static CompleteSmartPtr static_cast_from(const CompleteSmartPtr<U> &uptr)
- { return CompleteSmartPtr(*static_cast<element_type*>(uptr.ptr_)); }
+ { ++CompleteSmartPtrStats::static_cast_called; return CompleteSmartPtr(*static_cast<element_type*>(uptr.ptr_)); }
template<class U>
static CompleteSmartPtr const_cast_from(const CompleteSmartPtr<U> &uptr)
- { return CompleteSmartPtr(*const_cast<element_type*>(uptr.ptr_)); }
+ { ++CompleteSmartPtrStats::const_cast_called; return CompleteSmartPtr(*const_cast<element_type*>(uptr.ptr_)); }
template<class U>
static CompleteSmartPtr dynamic_cast_from(const CompleteSmartPtr<U> &uptr)
- { return CompleteSmartPtr(*dynamic_cast<element_type*>(uptr.ptr_)); }
+ { ++CompleteSmartPtrStats::dynamic_cast_called; return CompleteSmartPtr(*dynamic_cast<element_type*>(uptr.ptr_)); }
friend bool operator ==(const CompleteSmartPtr &l, const CompleteSmartPtr &r)
{ return l.ptr_ == r.ptr_; }
@@ -128,18 +149,10 @@ int main()
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<boost::intrusive::pointer_traits
<int*>::rebind_pointer<double>::type
, double*>::value ));
- if(boost::intrusive::pointer_traits<int*>::pointer_to(dummy) != &dummy){
- return 1;
- }
- if(boost::intrusive::pointer_traits<D*>::static_cast_from((B*)0)){
- return 1;
- }
- if(boost::intrusive::pointer_traits<D*>::const_cast_from((const D*)0)){
- return 1;
- }
- if(boost::intrusive::pointer_traits<DD*>::dynamic_cast_from((B*)0)){
- return 1;
- }
+ BOOST_TEST(boost::intrusive::pointer_traits<int*>::pointer_to(dummy) == &dummy);
+ BOOST_TEST(boost::intrusive::pointer_traits<D*>:: static_cast_from((B*)0) == 0);
+ BOOST_TEST(boost::intrusive::pointer_traits<D*>:: const_cast_from((const D*)0) == 0);
+ BOOST_TEST(boost::intrusive::pointer_traits<DD*>:: dynamic_cast_from((B*)0) == 0);
//Complete smart pointer
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<boost::intrusive::pointer_traits
@@ -151,22 +164,22 @@ int main()
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<boost::intrusive::pointer_traits
< CompleteSmartPtr<int> >::rebind_pointer<double>::type
, CompleteSmartPtr<double> >::value ));
- if(boost::intrusive::pointer_traits< CompleteSmartPtr<int> >
- ::pointer_to(dummy) != CompleteSmartPtr<int>(dummy)){
- return 1;
- }
- if(boost::intrusive::pointer_traits< CompleteSmartPtr<D> >::
- static_cast_from(CompleteSmartPtr<B>()) != CompleteSmartPtr<D>()){
- return 1;
- }
- if(boost::intrusive::pointer_traits< CompleteSmartPtr<D> >::
- const_cast_from(CompleteSmartPtr<const D>()) != CompleteSmartPtr<D>()){
- return 1;
- }
- if(boost::intrusive::pointer_traits< CompleteSmartPtr<DD> >::
- dynamic_cast_from(CompleteSmartPtr<B>()) != CompleteSmartPtr<DD>()){
- return 1;
- }
+ //pointer_to
+ CompleteSmartPtrStats::reset_stats();
+ BOOST_TEST(boost::intrusive::pointer_traits< CompleteSmartPtr<int> >::pointer_to(dummy) == CompleteSmartPtr<int>(dummy));
+ BOOST_TEST(CompleteSmartPtrStats::pointer_to_called == 1);
+ //static_cast_from
+ CompleteSmartPtrStats::reset_stats();
+ BOOST_TEST(boost::intrusive::pointer_traits< CompleteSmartPtr<D> >::static_cast_from(CompleteSmartPtr<B>()) == CompleteSmartPtr<D>());
+ BOOST_TEST(CompleteSmartPtrStats::static_cast_called == 1);
+ //const_cast_from
+ CompleteSmartPtrStats::reset_stats();
+ BOOST_TEST(boost::intrusive::pointer_traits< CompleteSmartPtr<D> >::const_cast_from(CompleteSmartPtr<const D>()) == CompleteSmartPtr<D>());
+ BOOST_TEST(CompleteSmartPtrStats::const_cast_called == 1);
+ //dynamic_cast_from
+ CompleteSmartPtrStats::reset_stats();
+ BOOST_TEST(boost::intrusive::pointer_traits< CompleteSmartPtr<DD> >::dynamic_cast_from(CompleteSmartPtr<B>()) == CompleteSmartPtr<DD>());
+ BOOST_TEST(CompleteSmartPtrStats::dynamic_cast_called == 1);
//Simple smart pointer
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<boost::intrusive::pointer_traits
@@ -178,21 +191,11 @@ int main()
BOOST_STATIC_ASSERT(( boost::intrusive::detail::is_same<boost::intrusive::pointer_traits
< SimpleSmartPtr<int> >::rebind_pointer<double>::type
, SimpleSmartPtr<double> >::value ));
- if(boost::intrusive::pointer_traits< SimpleSmartPtr<int> >
- ::pointer_to(dummy) != SimpleSmartPtr<int>(&dummy)){
- return 1;
- }
- if(boost::intrusive::pointer_traits< SimpleSmartPtr<D> >::
- static_cast_from(SimpleSmartPtr<B>()) != SimpleSmartPtr<D>()){
- return 1;
- }
- if(boost::intrusive::pointer_traits< SimpleSmartPtr<D> >::
- const_cast_from(SimpleSmartPtr<const D>()) != SimpleSmartPtr<D>()){
- return 1;
- }
- if(boost::intrusive::pointer_traits< SimpleSmartPtr<DD> >::
- dynamic_cast_from(SimpleSmartPtr<B>()) != SimpleSmartPtr<DD>()){
- return 1;
- }
- return 0;
+
+ BOOST_TEST(boost::intrusive::pointer_traits< SimpleSmartPtr<int> >::pointer_to(dummy) == SimpleSmartPtr<int>(&dummy));
+ BOOST_TEST(boost::intrusive::pointer_traits< SimpleSmartPtr<D> > ::static_cast_from(SimpleSmartPtr<B>()) == SimpleSmartPtr<D>());
+ BOOST_TEST(boost::intrusive::pointer_traits< SimpleSmartPtr<D> > ::const_cast_from(SimpleSmartPtr<const D>()) == SimpleSmartPtr<D>());
+ BOOST_TEST(boost::intrusive::pointer_traits< SimpleSmartPtr<DD> >::dynamic_cast_from(SimpleSmartPtr<B>()) == SimpleSmartPtr<DD>());
+
+ return boost::report_errors();
}
diff --git a/libs/intrusive/test/smart_ptr.hpp b/libs/intrusive/test/smart_ptr.hpp
index 28004305a..724e9da3a 100644
--- a/libs/intrusive/test/smart_ptr.hpp
+++ b/libs/intrusive/test/smart_ptr.hpp
@@ -11,9 +11,10 @@
#ifndef BOOST_INTRUSIVE_SMART_PTR_HPP
#define BOOST_INTRUSIVE_SMART_PTR_HPP
-#include <boost/iterator.hpp>
#include <boost/intrusive/pointer_plus_bits.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
+#include <boost/move/adl_move_swap.hpp>
#if (defined _MSC_VER)
# pragma once
@@ -36,8 +37,7 @@ struct empty_type{};
template<class T>
struct random_it
-: public boost::iterator<std::random_access_iterator_tag,
- T, std::ptrdiff_t, T*, T&>
+: public iterator<std::random_access_iterator_tag, T, std::ptrdiff_t, T*, T&>
{
typedef const T* const_pointer;
typedef const T& const_reference;
@@ -190,6 +190,10 @@ class smart_ptr
//!Never throws.
bool operator! () const
{ return m_ptr == 0; }
+
+ //!swap
+ friend void swap(smart_ptr& x, smart_ptr& y)
+ { boost::adl_move_swap(x.m_ptr, y.m_ptr); }
};
//!smart_ptr<T1> == smart_ptr<T2>. Never throws.
@@ -250,16 +254,6 @@ template<class T, class T2>
inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt2)
{ return pt.operator->()- pt2.operator->(); }
-//!swap specialization
-template<class T>
-inline void swap (smart_ptr<T> &pt,
- smart_ptr<T> &pt2)
-{
- typename smart_ptr<T>::value_type *ptr = pt.operator->();
- pt = pt2;
- pt2 = ptr;
-}
-
} //namespace intrusive {
} //namespace boost {
diff --git a/libs/intrusive/test/test_container.hpp b/libs/intrusive/test/test_container.hpp
index 13f6f2210..7872101b1 100644
--- a/libs/intrusive/test/test_container.hpp
+++ b/libs/intrusive/test/test_container.hpp
@@ -16,6 +16,7 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/simple_disposers.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
#include <boost/move/utility_core.hpp>
namespace boost {
@@ -386,14 +387,14 @@ void test_unordered_associative_container_invariants(Container & c, Data & d)
di != de ; ++di ){
const_iterator i = c.find(*di);
size_type nb = c.bucket(*i);
- size_type bucket_elem = std::distance(c.begin(nb), c.end(nb));
+ size_type bucket_elem = boost::intrusive::iterator_distance(c.begin(nb), c.end(nb));
BOOST_TEST( bucket_elem == c.bucket_size(nb) );
BOOST_TEST( &*c.local_iterator_to(*c.find(*di)) == &*i );
BOOST_TEST( &*c.local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
BOOST_TEST( &*Container::s_local_iterator_to(*c.find(*di)) == &*i );
BOOST_TEST( &*Container::s_local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
std::pair<const_iterator, const_iterator> er = c.equal_range(*di);
- size_type cnt = std::distance(er.first, er.second);
+ size_type cnt = boost::intrusive::iterator_distance(er.first, er.second);
BOOST_TEST( cnt == c.count(*di));
if(cnt > 1){
const_iterator n = er.first;
diff --git a/libs/intrusive/test/unordered_multiset_test.cpp b/libs/intrusive/test/unordered_multiset_test.cpp
index 714460304..bb0e23453 100644
--- a/libs/intrusive/test/unordered_multiset_test.cpp
+++ b/libs/intrusive/test/unordered_multiset_test.cpp
@@ -12,13 +12,15 @@
/////////////////////////////////////////////////////////////////////////////
#include <boost/intrusive/unordered_set.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
#include "itestvalue.hpp"
#include "smart_ptr.hpp"
#include "common_functors.hpp"
#include <vector>
-#include <algorithm> //std::sort std::find
+#include <algorithm> //std::sort
#include <set>
#include <boost/detail/lightweight_test.hpp>
+
#include "test_macros.hpp"
#include "test_container.hpp"
@@ -367,7 +369,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
}
//Erase the same values in both the intrusive and original vector
- std::size_t erased_cnt = std::distance(it_beg_pos, it_end_pos);
+ std::size_t erased_cnt = boost::intrusive::iterator_distance(it_beg_pos, it_end_pos);
//Erase values from the intrusive container
testset.erase(it_beg_pos, it_end_pos);
@@ -671,7 +673,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 2);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
diff --git a/libs/intrusive/test/unordered_set_test.cpp b/libs/intrusive/test/unordered_set_test.cpp
index 271344fe8..96aa58156 100644
--- a/libs/intrusive/test/unordered_set_test.cpp
+++ b/libs/intrusive/test/unordered_set_test.cpp
@@ -12,6 +12,7 @@
/////////////////////////////////////////////////////////////////////////////
#include <boost/intrusive/unordered_set.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/detail/iterator.hpp>
#include "itestvalue.hpp"
#include "smart_ptr.hpp"
#include "common_functors.hpp"
@@ -180,7 +181,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
unordered_set_type testset1(values.begin(), values.end(), bucket_traits(
pointer_traits<typename unordered_set_type::bucket_ptr>::
pointer_to(buckets[0]), BucketSize));
- BOOST_TEST (5 == std::distance(testset1.begin(), testset1.end()));
+ BOOST_TEST (5 == boost::intrusive::iterator_distance(testset1.begin(), testset1.end()));
if(Incremental){
{ int init_values [] = { 4, 5, 1, 2, 3 };
@@ -525,7 +526,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
- BOOST_TEST (std::distance (range.first, range.second) == 1);
+ BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());