2007-05-04 21:30:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// (C) Copyright Olaf Krzikalla 2004-2006.
|
2007-05-12 12:34:55 +00:00
|
|
|
// (C) Copyright Ion Gaztanaga 2006-2007.
|
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>
|
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"
|
|
|
|
|
|
|
|
template< class ValueType
|
|
|
|
, class Option1 = boost::intrusive::none
|
|
|
|
, class Option2 = boost::intrusive::none
|
|
|
|
, class Option3 = boost::intrusive::none
|
|
|
|
>
|
|
|
|
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;
|
2007-09-26 17:38:32 +00:00
|
|
|
typedef testvalue<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
|
|
|
|
, typename value_type::set_base_hook_t
|
|
|
|
>::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
|
|
|
|
, typename value_type::set_member_hook_t
|
|
|
|
, &value_type::set_node_
|
|
|
|
>
|
|
|
|
>::type
|
2007-11-18 10:44:56 +00:00
|
|
|
, 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;
|
2007-09-26 17:38:32 +00:00
|
|
|
typedef testvalue<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
|
|
|
|
, typename value_type::set_base_hook_t
|
|
|
|
>::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
|
|
|
|
, typename value_type::set_member_hook_t
|
|
|
|
, &value_type::set_node_
|
|
|
|
>
|
|
|
|
>::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
|
|
|
|
, typename value_type::set_auto_base_hook_t
|
|
|
|
>::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
|
|
|
|
, typename value_type::set_auto_member_hook_t
|
|
|
|
, &value_type::set_auto_node_
|
|
|
|
>
|
|
|
|
>::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
|
|
|
|
2007-05-12 12:34:55 +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
|
|
|
}
|
2007-06-23 13:09:46 +00:00
|
|
|
#include <boost/intrusive/detail/config_end.hpp>
|