20 #ifndef MULTI_POLICY_H_ 
   21 #define MULTI_POLICY_H_ 
   29 #include <boost/mpl/size.hpp> 
   30 #include <boost/mpl/at.hpp> 
   31 #include <boost/mpl/range_c.hpp> 
   32 #include <boost/mpl/transform.hpp> 
   33 #include <boost/mpl/back_inserter.hpp> 
   34 #include <boost/mpl/vector.hpp> 
   35 #include <boost/mpl/for_each.hpp> 
   37 #include <boost/intrusive/options.hpp> 
   43 template<
typename Policies> 
 
   44 struct multi_policy_traits {
 
   45   typedef Policies policy_traits;
 
   50       typedef typename Item::policy_hook_type type;
 
   53   typedef detail::multi_type_container<
 
   54     typename boost::mpl::transform1<policy_traits, getHook>::type> policy_hook_type;
 
   56   template<
class Container>
 
   57   struct container_hook {
 
   58     typedef policy_hook_type type;
 
   61   template<
class Base, 
class Container, 
class Hook>
 
   63     typedef boost::mpl::range_c<int, 0, boost::mpl::size<policy_traits>::type::value>
 
   67       template<
class Number>
 
   69         typedef typename boost::mpl::at_c<policy_traits, Number::value>::type::
 
   70           template policy<Base, Container,
 
   71                           boost::intrusive::function_hook<detail::FunctorHook<Hook, Container,
 
   72                                                                               Number::value>>>::type
 
   77     typedef typename boost::mpl::transform1<policies_range, getPolicy,
 
   78                                             boost::mpl::back_inserter<boost::mpl::vector0<>>>::type
 
   81     typedef detail::multi_policy_container<Base, policies> policy_container;
 
   83     class type : 
public policy_container {
 
   85       typedef policy policy_base; 
 
   86       typedef Container parent_trie;
 
   89         : policy_container(base)
 
   94       update(
typename parent_trie::iterator item)
 
   96         policy_container::update(item);
 
  100       insert(
typename parent_trie::iterator item)
 
  102         return policy_container::insert(item);
 
  106       lookup(
typename parent_trie::iterator item)
 
  108         policy_container::lookup(item);
 
  112       erase(
typename parent_trie::iterator item)
 
  114         policy_container::erase(item);
 
  120         policy_container::clear();
 
  123       struct max_size_setter {
 
  124         max_size_setter(policy_container& container, 
size_t size)
 
  125           : m_container(container)
 
  134           m_container.template get<U::value>().set_max_size(m_size);
 
  138         policy_container& m_container;
 
  143       set_max_size(
size_t max_size)
 
  145         boost::mpl::for_each<boost::mpl::range_c<int, 0,
 
  146                                                  boost::mpl::size<policy_traits>::type::value>>(
 
  147           max_size_setter(*
this, max_size));
 
  154         return policy_container::template get<0>().get_max_size();
 
  160     name_getter(std::string& name)
 
  171       m_name += boost::mpl::at_c<policy_traits, U::value>::type::GetName();
 
  183     boost::mpl::for_each<boost::mpl::range_c<int, 0, boost::mpl::size<policy_traits>::type::value>>(
 
  196 #endif // MULTI_POLICY_H_