forked from boostorg/intrusive
Changes and fixes for Boost 1.37
[SVN r49323]
This commit is contained in:
+296
-14
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
#include <boost/intrusive/detail/pointer_to_other.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
@@ -446,13 +447,12 @@ class test_main_template<VoidPointer, false>
|
||||
>
|
||||
>::type
|
||||
>::test_all(data);
|
||||
/*
|
||||
test_list<stateful_value_traits
|
||||
< value_type
|
||||
, list_node_traits<VoidPointer>
|
||||
, safe_link>
|
||||
>::test_all(data);
|
||||
*/
|
||||
|
||||
// test_list<stateful_value_traits
|
||||
// < value_type
|
||||
// , list_node_traits<VoidPointer>
|
||||
// , safe_link>
|
||||
// >::test_all(data);
|
||||
test_list < typename detail::get_base_value_traits
|
||||
< value_type
|
||||
, typename value_type::list_auto_base_hook_t
|
||||
@@ -467,13 +467,13 @@ class test_main_template<VoidPointer, false>
|
||||
>
|
||||
>::type
|
||||
>::test_all(data);
|
||||
/*
|
||||
test_list<stateful_value_traits
|
||||
< value_type
|
||||
, list_node_traits<VoidPointer>
|
||||
, auto_unlink>
|
||||
>::test_all(data);
|
||||
*/
|
||||
|
||||
// test_list<stateful_value_traits
|
||||
// < value_type
|
||||
// , list_node_traits<VoidPointer>
|
||||
// , auto_unlink>
|
||||
// >::test_all(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
@@ -488,3 +488,285 @@ int main( int, char* [] )
|
||||
return boost::report_errors();
|
||||
}
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Builds an index_tuple<0, 1, 2, ..., Num-1>, that will
|
||||
// be used to "unpack" into comma-separated values
|
||||
// in a function call.
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
template<int... Indexes>
|
||||
struct index_tuple{};
|
||||
|
||||
template<std::size_t Num, typename Tuple = index_tuple<> >
|
||||
struct build_number_seq;
|
||||
|
||||
template<std::size_t Num, int... Indexes>
|
||||
struct build_number_seq<Num, index_tuple<Indexes...> >
|
||||
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
|
||||
{};
|
||||
|
||||
template<int... Indexes>
|
||||
struct build_number_seq<0, index_tuple<Indexes...> >
|
||||
{ typedef index_tuple<Indexes...> type; };
|
||||
|
||||
template<class ...Types>
|
||||
struct typelist
|
||||
{};
|
||||
|
||||
template<class T>
|
||||
struct invert_typelist;
|
||||
|
||||
template<int I, typename Tuple>
|
||||
struct typelist_element;
|
||||
|
||||
template<int I, typename Head, typename... Tail>
|
||||
struct typelist_element<I, typelist<Head, Tail...> >
|
||||
{
|
||||
typedef typename typelist_element<I-1, typelist<Tail...> >::type type;
|
||||
};
|
||||
|
||||
template<typename Head, typename... Tail>
|
||||
struct typelist_element<0, typelist<Head, Tail...> >
|
||||
{
|
||||
typedef Head type;
|
||||
};
|
||||
|
||||
template<int ...Ints, class ...Types>
|
||||
typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>
|
||||
inverted_typelist(index_tuple<Ints...>, typelist<Types...>)
|
||||
{
|
||||
return typelist<typename typelist_element<(sizeof...(Types) - 1) - Ints, typelist<Types...> >::type...>();
|
||||
}
|
||||
|
||||
|
||||
template<class Typelist>
|
||||
struct sizeof_typelist;
|
||||
|
||||
template<class ...Types>
|
||||
struct sizeof_typelist< typelist<Types...> >
|
||||
{
|
||||
static const std::size_t value = sizeof...(Types);
|
||||
};
|
||||
|
||||
//invert_typelist_impl
|
||||
template<class Typelist, class Indexes>
|
||||
struct invert_typelist_impl;
|
||||
|
||||
|
||||
template<class Typelist, int ...Ints>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<Ints...> >
|
||||
{
|
||||
static const std::size_t last_idx = sizeof_typelist<Typelist>::value - 1;
|
||||
typedef typelist
|
||||
<typename typelist_element<last_idx - Ints, Typelist>::type...> type;
|
||||
};
|
||||
|
||||
template<class Typelist, int Int>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<Int> >
|
||||
{
|
||||
typedef Typelist type;
|
||||
};
|
||||
|
||||
template<class Typelist>
|
||||
struct invert_typelist_impl< Typelist, index_tuple<> >
|
||||
{
|
||||
typedef Typelist type;
|
||||
};
|
||||
|
||||
//invert_typelist
|
||||
template<class Typelist>
|
||||
struct invert_typelist;
|
||||
|
||||
template<class ...Types>
|
||||
struct invert_typelist< typelist<Types...> >
|
||||
{
|
||||
typedef typelist<Types...> typelist_t;
|
||||
typedef typename build_number_seq<sizeof...(Types)>::type indexes_t;
|
||||
typedef typename invert_typelist_impl<typelist_t, indexes_t>::type type;
|
||||
};
|
||||
|
||||
struct none
|
||||
{
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{ };
|
||||
};
|
||||
|
||||
//!This option setter specifies the type of
|
||||
//!a void pointer. This will instruct the hook
|
||||
//!to use this type of pointer instead of the
|
||||
//!default one
|
||||
template<class VoidPointer>
|
||||
struct void_pointer
|
||||
{
|
||||
/// @cond
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{
|
||||
typedef VoidPointer void_pointer;
|
||||
};
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
//!This option setter specifies the type of
|
||||
//!the tag of a base hook. A type cannot have two
|
||||
//!base hooks of the same type, so a tag can be used
|
||||
//!to differentiate two base hooks with otherwise same type
|
||||
template<class Tag>
|
||||
struct tag
|
||||
{
|
||||
/// @cond
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{
|
||||
typedef Tag tag;
|
||||
};
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
|
||||
//!This option setter specifies if the hook
|
||||
//!should be optimized for size instead of for speed.
|
||||
template<bool Enabled>
|
||||
struct optimize_size
|
||||
{
|
||||
/// @cond
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{
|
||||
static const bool optimize_size = Enabled;
|
||||
};
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
//!This option setter specifies if the list container should
|
||||
//!use a linear implementation instead of a circular one.
|
||||
template<bool Enabled>
|
||||
struct linear
|
||||
{
|
||||
/// @cond
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{
|
||||
static const bool linear = Enabled;
|
||||
};
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
//!This option setter specifies if the list container should
|
||||
//!use a linear implementation instead of a circular one.
|
||||
template<bool Enabled>
|
||||
struct cache_last
|
||||
{
|
||||
/// @cond
|
||||
template<class Base>
|
||||
struct pack : Base
|
||||
{
|
||||
static const bool cache_last = Enabled;
|
||||
};
|
||||
/// @endcond
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<class Typelist>
|
||||
struct do_pack;
|
||||
|
||||
template<>
|
||||
struct do_pack<typelist<> >;
|
||||
|
||||
template<class Prev>
|
||||
struct do_pack<typelist<Prev> >
|
||||
{
|
||||
typedef Prev type;
|
||||
};
|
||||
|
||||
template<class Prev, class Last>
|
||||
struct do_pack<typelist<Prev, Last> >
|
||||
{
|
||||
typedef typename Prev::template pack<Last> type;
|
||||
};
|
||||
|
||||
template<class Prev, class ...Others>
|
||||
struct do_pack<typelist<Prev, Others...> >
|
||||
{
|
||||
typedef typename Prev::template pack
|
||||
<typename do_pack<typelist<Others...>>::type> type;
|
||||
};
|
||||
|
||||
|
||||
template<class ...Options>
|
||||
struct pack_options
|
||||
{
|
||||
typedef typelist<Options...> typelist_t;
|
||||
typedef typename invert_typelist<typelist_t>::type inverted_typelist;
|
||||
typedef typename do_pack<inverted_typelist>::type type;
|
||||
};
|
||||
|
||||
struct hook_defaults
|
||||
: public pack_options
|
||||
< none
|
||||
, void_pointer<void*>
|
||||
, tag<int>
|
||||
, optimize_size<false>
|
||||
, linear<false>
|
||||
>::type
|
||||
{};
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
|
||||
struct S
|
||||
{};
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef typelist<int, float, double> typelist_t;
|
||||
typedef invert_typelist<typelist_t>::type inverted_typelist;
|
||||
std::cout << "original: " << typeid(typelist_t).name() << std::endl;
|
||||
std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
|
||||
}
|
||||
{
|
||||
typedef typelist<int> typelist_t;
|
||||
typedef invert_typelist<typelist_t>::type inverted_typelist;
|
||||
std::cout << "original: " << typeid(typelist_t).name() << std::endl;
|
||||
std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
|
||||
}
|
||||
{
|
||||
typedef typelist<> typelist_t;
|
||||
typedef invert_typelist<typelist_t>::type inverted_typelist;
|
||||
std::cout << "original: " << typeid(typelist_t).name() << std::endl;
|
||||
std::cout << "inverted: " << typeid(inverted_typelist).name() << std::endl;
|
||||
}
|
||||
{
|
||||
typedef pack_options<S, none>::type options_t;
|
||||
std::cout << "options_t " << typeid(options_t).name() << std::endl;
|
||||
}
|
||||
{
|
||||
typedef pack_options<S, none, none>::type options_t;
|
||||
std::cout << "options_t " << typeid(options_t).name() << std::endl;
|
||||
}
|
||||
|
||||
hook_defaults h;
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user