2007-05-04 21:30:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
2013-07-28 22:10:37 +00:00
|
|
|
// (C) Copyright Ion Gaztanaga 2006-2013.
|
2007-05-04 21:30:54 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2007-06-23 13:09:46 +00:00
|
|
|
#include <boost/intrusive/detail/config_begin.hpp>
|
2009-10-14 13:08:04 +00:00
|
|
|
|
2007-05-04 21:30:54 +00:00
|
|
|
#include <boost/intrusive/set.hpp>
|
|
|
|
#include "itestvalue.hpp"
|
|
|
|
#include "smart_ptr.hpp"
|
2007-11-18 10:44:56 +00:00
|
|
|
#include "generic_set_test.hpp"
|
|
|
|
|
2009-10-14 13:08:04 +00:00
|
|
|
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
|
2012-05-20 09:54:48 +00:00
|
|
|
struct has_insert_before<boost::intrusive::set<T,
|
2009-10-14 13:08:04 +00:00
|
|
|
#if !defined (BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
|
|
|
O1, O2, O3, O4
|
|
|
|
#else
|
|
|
|
Options...
|
|
|
|
#endif
|
|
|
|
> >
|
|
|
|
{
|
|
|
|
static const bool value = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
}}}
|
|
|
|
|
2008-12-13 13:49:31 +00:00
|
|
|
struct my_tag;
|
|
|
|
|
|
|
|
using namespace boost::intrusive;
|
|
|
|
|
|
|
|
template<class VoidPointer>
|
|
|
|
struct hooks
|
|
|
|
{
|
|
|
|
typedef set_base_hook
|
|
|
|
<void_pointer<VoidPointer> > base_hook_type;
|
|
|
|
typedef set_base_hook
|
|
|
|
<link_mode<auto_unlink>
|
|
|
|
, void_pointer<VoidPointer>
|
|
|
|
, tag<my_tag>
|
|
|
|
, optimize_size<true> > auto_base_hook_type;
|
|
|
|
typedef set_member_hook<void_pointer
|
|
|
|
<VoidPointer>, optimize_size<true> > member_hook_type;
|
|
|
|
typedef set_member_hook
|
|
|
|
<link_mode<auto_unlink>, void_pointer<VoidPointer> > auto_member_hook_type;
|
2014-04-28 20:08:24 -04:00
|
|
|
typedef nonhook_node_member< rbtree_node_traits <VoidPointer, false >,
|
|
|
|
rbtree_algorithms
|
|
|
|
> nonhook_node_member_type;
|
2008-12-13 13:49:31 +00:00
|
|
|
};
|
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
template< class ValueType
|
2013-07-28 22:10:37 +00:00
|
|
|
, class Option1 =void
|
|
|
|
, class Option2 =void
|
|
|
|
, class Option3 =void
|
2007-11-18 10:44:56 +00:00
|
|
|
>
|
|
|
|
struct GetContainer
|
2007-05-04 21:30:54 +00:00
|
|
|
{
|
2007-11-18 10:44:56 +00:00
|
|
|
typedef boost::intrusive::set
|
|
|
|
< ValueType
|
|
|
|
, Option1
|
|
|
|
, Option2
|
|
|
|
, Option3
|
|
|
|
> type;
|
2007-05-04 21:30:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<class VoidPointer, bool constant_time_size>
|
|
|
|
class test_main_template
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int operator()()
|
|
|
|
{
|
2007-11-18 10:44:56 +00:00
|
|
|
using namespace boost::intrusive;
|
2008-12-13 13:49:31 +00:00
|
|
|
typedef testvalue<hooks<VoidPointer> , constant_time_size> value_type;
|
2007-05-04 21:30:54 +00:00
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
test::test_generic_set < typename detail::get_base_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::base_hook_type
|
2007-09-26 17:38:32 +00:00
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
|
|
|
test::test_generic_set < typename detail::get_member_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
|
|
|
, member_hook< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::member_hook_type
|
|
|
|
, &value_type::node_
|
2007-09-26 17:38:32 +00:00
|
|
|
>
|
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
2014-04-28 20:08:24 -04:00
|
|
|
test::test_generic_set < nonhook_node_member_value_traits< value_type,
|
|
|
|
typename hooks<VoidPointer>::nonhook_node_member_type,
|
|
|
|
&value_type::nhn_member_,
|
|
|
|
safe_link
|
|
|
|
>,
|
|
|
|
GetContainer
|
|
|
|
>::test_all();
|
2007-05-04 21:30:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class VoidPointer>
|
|
|
|
class test_main_template<VoidPointer, false>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int operator()()
|
|
|
|
{
|
2007-11-18 10:44:56 +00:00
|
|
|
using namespace boost::intrusive;
|
2008-12-13 13:49:31 +00:00
|
|
|
typedef testvalue<hooks<VoidPointer> , false> value_type;
|
2007-05-04 21:30:54 +00:00
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
test::test_generic_set < typename detail::get_base_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::base_hook_type
|
2007-09-26 17:38:32 +00:00
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
2007-09-26 17:38:32 +00:00
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
test::test_generic_set < typename detail::get_member_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
|
|
|
, member_hook< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::member_hook_type
|
|
|
|
, &value_type::node_
|
2007-09-26 17:38:32 +00:00
|
|
|
>
|
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
2007-09-26 17:38:32 +00:00
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
test::test_generic_set < typename detail::get_base_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::auto_base_hook_type
|
2007-09-26 17:38:32 +00:00
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
2007-09-26 17:38:32 +00:00
|
|
|
|
2007-11-18 10:44:56 +00:00
|
|
|
test::test_generic_set < typename detail::get_member_value_traits
|
2007-09-26 17:38:32 +00:00
|
|
|
< value_type
|
|
|
|
, member_hook< value_type
|
2008-12-13 13:49:31 +00:00
|
|
|
, typename hooks<VoidPointer>::auto_member_hook_type
|
|
|
|
, &value_type::auto_node_
|
2007-09-26 17:38:32 +00:00
|
|
|
>
|
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, GetContainer
|
|
|
|
>::test_all();
|
2007-05-04 21:30:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
2007-09-26 17:38:32 +00:00
|
|
|
|
Interprocess:
[@https://svn.boost.org/trac/boost/ticket/3439 #3439],
[@https://svn.boost.org/trac/boost/ticket/3846 #3846],
[@https://svn.boost.org/trac/boost/ticket/3947 #3947],
[@https://svn.boost.org/trac/boost/ticket/3985 #3985].
Intrusive:
[@https://svn.boost.org/trac/boost/ticket/3668 #3668],
[@https://svn.boost.org/trac/boost/ticket/3339 #3688],
[@https://svn.boost.org/trac/boost/ticket/3698 #3698],
[@https://svn.boost.org/trac/boost/ticket/3706 #3706],
[@https://svn.boost.org/trac/boost/ticket/3721 #3721].
[@https://svn.boost.org/trac/boost/ticket/3729 #3729],
[@https://svn.boost.org/trac/boost/ticket/3746 #3746],
[@https://svn.boost.org/trac/boost/ticket/3781 #3781],
[@https://svn.boost.org/trac/boost/ticket/3829 #3829],
[@https://svn.boost.org/trac/boost/ticket/3840 #3840],
[@https://svn.boost.org/trac/boost/ticket/3339 #3339],
[@https://svn.boost.org/trac/boost/ticket/3419 #3419],
[@https://svn.boost.org/trac/boost/ticket/3431 #3431],
[SVN r60515]
2010-03-12 13:22:13 +00:00
|
|
|
|
2012-05-20 09:54:48 +00:00
|
|
|
int main( int, char* [] )
|
2007-05-04 21:30:54 +00:00
|
|
|
{
|
|
|
|
test_main_template<void*, false>()();
|
2007-11-18 10:44:56 +00:00
|
|
|
test_main_template<boost::intrusive::smart_ptr<void>, false>()();
|
2007-05-04 21:30:54 +00:00
|
|
|
test_main_template<void*, true>()();
|
2007-11-18 10:44:56 +00:00
|
|
|
test_main_template<boost::intrusive::smart_ptr<void>, true>()();
|
2007-05-12 12:34:55 +00:00
|
|
|
return boost::report_errors();
|
2007-05-04 21:30:54 +00:00
|
|
|
}
|
2009-10-14 13:08:04 +00:00
|
|
|
|
2007-06-23 13:09:46 +00:00
|
|
|
#include <boost/intrusive/detail/config_end.hpp>
|