forked from boostorg/intrusive
Fixes for 1.41
[SVN r56876]
This commit is contained in:
1 parent
6f941ef73c
commit
6b67d4eb9d
64 files changed
+690
-117
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -17,6 +17,26 @@
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::avl_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
+22
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -16,6 +16,27 @@
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::avl_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -35,6 +35,12 @@ struct has_rebalance
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct has_insert_before
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
struct test_generic_assoc
|
||||
{
|
||||
@@ -52,6 +58,9 @@ struct test_generic_assoc
|
||||
static void test_rebalance(std::vector<value_type>& values);
|
||||
static void test_rebalance(std::vector<value_type>& values, boost::intrusive::detail::true_type);
|
||||
static void test_rebalance(std::vector<value_type>& values, boost::intrusive::detail::false_type);
|
||||
static void test_insert_before(std::vector<value_type>& values);
|
||||
static void test_insert_before(std::vector<value_type>& values, boost::intrusive::detail::true_type);
|
||||
static void test_insert_before(std::vector<value_type>& values, boost::intrusive::detail::false_type);
|
||||
static void test_container_from_iterator(std::vector<value_type>& values);
|
||||
};
|
||||
|
||||
@@ -149,6 +158,7 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_all(std::vector<typ
|
||||
test_splay_up(values);
|
||||
test_splay_down(values);
|
||||
test_rebalance(values);
|
||||
test_insert_before(values);
|
||||
test_insert_erase_burst();
|
||||
test_container_from_iterator(values);
|
||||
}
|
||||
@@ -365,6 +375,73 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_rebalance
|
||||
test_rebalance(values, enabler());
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
|
||||
(std::vector<typename ValueTraits::value_type>& values, boost::intrusive::detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type assoc_type;
|
||||
{
|
||||
assoc_type testset;
|
||||
typedef typename std::vector<value_type>::iterator vec_iterator;
|
||||
for(vec_iterator it(values.begin()), itend(values.end())
|
||||
; it != itend
|
||||
; ++it){
|
||||
testset.push_back(*it);
|
||||
}
|
||||
BOOST_TEST(testset.size() == values.size());
|
||||
TEST_INTRUSIVE_SEQUENCE_EXPECTED(values, testset.begin());
|
||||
}
|
||||
{
|
||||
assoc_type testset;
|
||||
typedef typename std::vector<value_type>::iterator vec_iterator;
|
||||
for(vec_iterator it(--values.end()), itend(--values.begin())
|
||||
; it != itend
|
||||
; --it){
|
||||
testset.push_front(*it);
|
||||
}
|
||||
BOOST_TEST(testset.size() == values.size());
|
||||
TEST_INTRUSIVE_SEQUENCE_EXPECTED(values, testset.begin());
|
||||
}
|
||||
{
|
||||
assoc_type testset;
|
||||
typedef typename std::vector<value_type>::iterator vec_iterator;
|
||||
typename assoc_type::iterator it_pos =
|
||||
testset.insert_before(testset.end(), *values.rbegin());
|
||||
testset.insert_before(testset.begin(), *values.begin());
|
||||
for(vec_iterator it(++values.begin()), itend(--values.end())
|
||||
; it != itend
|
||||
; ++it){
|
||||
testset.insert_before(it_pos, *it);
|
||||
}
|
||||
BOOST_TEST(testset.size() == values.size());
|
||||
TEST_INTRUSIVE_SEQUENCE_EXPECTED(values, testset.begin());
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
|
||||
(std::vector<typename ValueTraits::value_type>&, boost::intrusive::detail::false_type)
|
||||
{}
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
|
||||
(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type assoc_type;
|
||||
typedef typename detail::remove_const<assoc_type>::type Type;
|
||||
typedef detail::bool_<has_insert_before<Type>::value> enabler;
|
||||
test_insert_before(values, enabler());
|
||||
}
|
||||
|
||||
}}} //namespace boost::intrusive::test
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
+92
-20
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -23,6 +23,12 @@ namespace boost{
|
||||
namespace intrusive{
|
||||
namespace test{
|
||||
|
||||
template<class T>
|
||||
struct is_treap
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
struct test_generic_set
|
||||
{
|
||||
@@ -30,6 +36,9 @@ struct test_generic_set
|
||||
static void test_all();
|
||||
static void test_sort(std::vector<value_type>& values);
|
||||
static void test_insert(std::vector<value_type>& values);
|
||||
static void test_insert_advanced(std::vector<value_type>& values, boost::intrusive::detail::true_type);
|
||||
static void test_insert_advanced(std::vector<value_type>& values, boost::intrusive::detail::false_type);
|
||||
static void test_insert_advanced(std::vector<value_type>& values);
|
||||
static void test_swap(std::vector<value_type>& values);
|
||||
static void test_find(std::vector<value_type>& values);
|
||||
static void test_impl();
|
||||
@@ -65,6 +74,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_all()
|
||||
}
|
||||
test_sort(values);
|
||||
test_insert(values);
|
||||
test_insert_advanced(values);
|
||||
test_swap(values);
|
||||
test_find(values);
|
||||
test_impl();
|
||||
@@ -139,32 +149,94 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(std::vector<ty
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type set_type;
|
||||
set_type testset;
|
||||
testset.insert(&values[0] + 2, &values[0] + 5);
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(&values[0] + 2, &values[0] + 5);
|
||||
|
||||
const set_type& const_testset = testset;
|
||||
{ int init_values [] = { 1, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
const set_type& const_testset = testset;
|
||||
{ int init_values [] = { 1, 4, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
|
||||
|
||||
typename set_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 1);
|
||||
typename set_type::iterator i = testset.begin();
|
||||
BOOST_TEST (i->value_ == 1);
|
||||
|
||||
i = testset.insert (i, values[0]);
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
i = testset.insert (i, values[0]);
|
||||
BOOST_TEST (&*i == &values[0]);
|
||||
|
||||
{ int init_values [] = { 5, 4, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset.rbegin() ); }
|
||||
{ int init_values [] = { 5, 4, 3, 1 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset.rbegin() ); }
|
||||
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
i = testset.iterator_to (values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
|
||||
i = set_type::s_iterator_to(values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
i = set_type::s_iterator_to(values[2]);
|
||||
BOOST_TEST (&*i == &values[2]);
|
||||
|
||||
testset.erase (i);
|
||||
{ int init_values [] = { 1, 3, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); }
|
||||
}
|
||||
}
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert_advanced
|
||||
(std::vector<typename ValueTraits::value_type>& values, boost::intrusive::detail::true_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type set_type;
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(&values[0], &values[0] + values.size());
|
||||
value_type v(1);
|
||||
typename set_type::insert_commit_data data;
|
||||
BOOST_TEST (!testset.insert_check(v, testset.value_comp(), testset.priority_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), v, testset.value_comp(), testset.priority_comp(), data).second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert_advanced
|
||||
(std::vector<typename ValueTraits::value_type>& values)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type set_type;
|
||||
typedef typename detail::remove_const<set_type>::type Type;
|
||||
typedef detail::bool_<is_treap<Type>::value> enabler;
|
||||
test_insert_advanced(values, enabler());
|
||||
}
|
||||
|
||||
|
||||
//test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert_advanced
|
||||
( std::vector<typename ValueTraits::value_type>& values
|
||||
, boost::intrusive::detail::false_type)
|
||||
{
|
||||
typedef typename ValueTraits::value_type value_type;
|
||||
typedef typename ContainerDefiner
|
||||
< value_type
|
||||
, value_traits<ValueTraits>
|
||||
, constant_time_size<value_type::constant_time_size>
|
||||
>::type set_type;
|
||||
{
|
||||
set_type testset;
|
||||
testset.insert(&values[0], &values[0] + values.size());
|
||||
value_type v(1);
|
||||
typename set_type::insert_commit_data data;
|
||||
BOOST_TEST (!testset.insert_check(v, testset.value_comp(), data).second);
|
||||
BOOST_TEST (!testset.insert_check(testset.begin(), v, testset.value_comp(), data).second);
|
||||
}
|
||||
}
|
||||
|
||||
testset.erase (i);
|
||||
{ int init_values [] = { 1, 3, 5 };
|
||||
TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); }
|
||||
}
|
||||
|
||||
//test: insert (seq-version), swap, erase (seq-version), size:
|
||||
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
|
||||
|
||||
+30
-4
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -115,12 +115,13 @@ std::size_t hash_value(const testvalue<Hooks, ConstantTimeSize> &t)
|
||||
}
|
||||
|
||||
template<class Hooks, bool ConstantTimeSize>
|
||||
bool priority_order(const testvalue<Hooks, ConstantTimeSize> &t1, const testvalue<Hooks, ConstantTimeSize> &t2)
|
||||
bool priority_order( const testvalue<Hooks, ConstantTimeSize> &t1
|
||||
, const testvalue<Hooks, ConstantTimeSize> &t2)
|
||||
{
|
||||
std::size_t hash1 = hash_value(t1);
|
||||
boost::hash_combine(hash1,&t1);
|
||||
boost::hash_combine(hash1, &t1);
|
||||
std::size_t hash2 = hash_value(t2);
|
||||
boost::hash_combine(hash2,&t2);
|
||||
boost::hash_combine(hash2, &t2);
|
||||
return hash1 < hash2;
|
||||
}
|
||||
|
||||
@@ -150,6 +151,31 @@ struct is_even
|
||||
(const testvalue<Hooks, constant_time_size>& v1) const
|
||||
{ return (v1.value_ & 1) == 0; }
|
||||
};
|
||||
/*
|
||||
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{
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
+21
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -16,6 +16,26 @@
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
+23
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -11,11 +11,32 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/intrusive/set.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
struct my_tag;
|
||||
|
||||
using namespace boost::intrusive;
|
||||
@@ -134,4 +155,5 @@ int main( int, char* [] )
|
||||
test_main_template<boost::intrusive::smart_ptr<void>, true>()();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -34,6 +34,23 @@ struct has_rebalance<boost::intrusive::sg_multiset<T,
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::sg_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
@@ -33,6 +33,22 @@ struct has_rebalance<boost::intrusive::sg_set<T,
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::sg_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
+101
-5
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -20,6 +20,12 @@ namespace boost {
|
||||
namespace intrusive {
|
||||
namespace test {
|
||||
|
||||
template<class T>
|
||||
struct is_unordered
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct has_const_overloads
|
||||
{
|
||||
@@ -78,6 +84,7 @@ void test_sequence_container(Container & c, Data & d)
|
||||
BOOST_TEST( c.size() == 0 );
|
||||
BOOST_TEST( c.empty() );
|
||||
|
||||
|
||||
{
|
||||
typename Data::iterator i = d.begin();
|
||||
c.insert( c.begin(), *i );
|
||||
@@ -87,7 +94,8 @@ void test_sequence_container(Container & c, Data & d)
|
||||
BOOST_TEST( c.size() == 2 );
|
||||
BOOST_TEST( !c.empty() );
|
||||
|
||||
c.erase( c.begin() );
|
||||
typename Container::iterator i;
|
||||
i = c.erase( c.begin() );
|
||||
|
||||
BOOST_TEST( c.size() == 1 );
|
||||
|
||||
@@ -97,7 +105,8 @@ void test_sequence_container(Container & c, Data & d)
|
||||
c.insert( c.begin(), *(i) );
|
||||
}
|
||||
|
||||
c.erase( c.begin(), c.end() );
|
||||
i = c.erase( c.begin(), c.end() );
|
||||
BOOST_TEST( i == c.end() );
|
||||
|
||||
BOOST_TEST( c.empty() );
|
||||
|
||||
@@ -107,7 +116,8 @@ void test_sequence_container(Container & c, Data & d)
|
||||
|
||||
BOOST_TEST( c.begin() != c.end() );
|
||||
|
||||
c.erase( c.begin() );
|
||||
i = c.erase_and_dispose( c.begin(), detail::null_disposer() );
|
||||
BOOST_TEST( i == c.begin() );
|
||||
|
||||
c.assign(d.begin(), d.end());
|
||||
|
||||
@@ -119,9 +129,90 @@ void test_sequence_container(Container & c, Data & d)
|
||||
BOOST_TEST( c.empty() );
|
||||
}
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d, boost::intrusive::detail::true_ unordered)
|
||||
{
|
||||
(void)unordered;
|
||||
typedef typename Container::size_type size_type;
|
||||
|
||||
assert( d.size() > 2 );
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( c.find(*di) != c.end() );
|
||||
}
|
||||
|
||||
typename Data::const_iterator db = d.begin();
|
||||
typename Data::const_iterator da = db++;
|
||||
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da, c.hash_function(), c.key_eq());
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should not eras anyone
|
||||
size_type second_erase = c.erase_and_dispose
|
||||
( *da, c.hash_function(), c.key_eq(), detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da, c.hash_function(), c.key_eq()) == 0 );
|
||||
BOOST_TEST( c.count(*db, c.hash_function(), c.key_eq()) != 0 );
|
||||
|
||||
BOOST_TEST( c.find(*da, c.hash_function(), c.key_eq()) == c.end() );
|
||||
BOOST_TEST( c.find(*db, c.hash_function(), c.key_eq()) != c.end() );
|
||||
|
||||
BOOST_TEST( c.equal_range(*db, c.hash_function(), c.key_eq()).first != c.end() );
|
||||
|
||||
c.clear();
|
||||
|
||||
BOOST_TEST( c.equal_range(*da, c.hash_function(), c.key_eq()).first == c.end() );
|
||||
}
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d, boost::intrusive::detail::false_ unordered)
|
||||
{
|
||||
(void)unordered;
|
||||
typedef typename Container::size_type size_type;
|
||||
|
||||
assert( d.size() > 2 );
|
||||
|
||||
c.clear();
|
||||
c.insert(d.begin(), d.end());
|
||||
|
||||
for( typename Data::const_iterator di = d.begin(), de = d.end();
|
||||
di != de; ++di )
|
||||
{
|
||||
BOOST_TEST( c.find(*di, c.key_comp()) != c.end() );
|
||||
}
|
||||
|
||||
typename Data::const_iterator db = d.begin();
|
||||
typename Data::const_iterator da = db++;
|
||||
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da, c.key_comp());
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should not eras anyone
|
||||
size_type second_erase = c.erase_and_dispose( *da, c.key_comp(), detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da, c.key_comp()) == 0 );
|
||||
BOOST_TEST( c.count(*db, c.key_comp()) != 0 );
|
||||
BOOST_TEST( c.find(*da, c.key_comp()) == c.end() );
|
||||
BOOST_TEST( c.find(*db, c.key_comp()) != c.end() );
|
||||
BOOST_TEST( c.equal_range(*db, c.key_comp()).first != c.end() );
|
||||
c.clear();
|
||||
BOOST_TEST( c.equal_range(*da, c.key_comp()).first == c.end() );
|
||||
}
|
||||
|
||||
|
||||
template< class Container, class Data >
|
||||
void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
{
|
||||
{
|
||||
typedef typename Container::size_type size_type;
|
||||
|
||||
assert( d.size() > 2 );
|
||||
@@ -141,8 +232,10 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
size_type old_size = c.size();
|
||||
|
||||
c.erase(*da);
|
||||
|
||||
BOOST_TEST( c.size() == old_size-1 );
|
||||
//This should not eras anyone
|
||||
size_type second_erase = c.erase_and_dispose( *da, detail::null_disposer() );
|
||||
BOOST_TEST( second_erase == 0 );
|
||||
|
||||
BOOST_TEST( c.count(*da) == 0 );
|
||||
BOOST_TEST( c.count(*db) != 0 );
|
||||
@@ -155,6 +248,9 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
|
||||
c.clear();
|
||||
|
||||
BOOST_TEST( c.equal_range(*da).first == c.end() );
|
||||
}
|
||||
typedef detail::bool_<is_unordered<Container>::value> enabler;
|
||||
test_common_unordered_and_associative_container(c, d, enabler());
|
||||
}
|
||||
|
||||
template< class Container, class Data >
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -17,6 +17,26 @@
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_multiset_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::treap_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
+38
-1
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -15,6 +15,43 @@
|
||||
#include "smart_ptr.hpp"
|
||||
#include "generic_set_test.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct has_insert_before<boost::intrusive::treap_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_treap<boost::intrusive::treap_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -23,6 +23,26 @@
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_unordered<boost::intrusive::unordered_multiset<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2008.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2009.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -22,6 +22,26 @@
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
|
||||
namespace boost { namespace intrusive { namespace test {
|
||||
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
struct is_unordered<boost::intrusive::unordered_set<T,
|
||||
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3, O4, O5, O6
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
using namespace boost::intrusive;
|
||||
|
||||
struct my_tag;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2008
|
||||
// (C) Copyright Ion Gaztanaga 2007-2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
Reference in new issue
Block a user