20 #ifndef MULTI_POLICY_CONTAINER_H_ 21 #define MULTI_POLICY_CONTAINER_H_ 25 #include <boost/mpl/inherit_linearly.hpp> 26 #include <boost/mpl/at.hpp> 33 template<
class Base,
class Value>
35 policy_wrap(Base& base)
42 template<
class Base,
class Super ,
44 struct inherit_with_base : Super, Value {
45 inherit_with_base(Base& base)
54 Value::value_.update(item);
61 bool ok = Value::value_.insert(item);
65 ok = Super::insert(item);
67 Value::value_.erase(item);
76 Value::value_.lookup(item);
83 Value::value_.erase(item);
90 Value::value_.clear();
96 struct empty_policy_wrap {
97 empty_policy_wrap(Base& base)
124 template<
class Base,
class Vector>
125 struct multi_policy_container
126 :
public boost::mpl::
127 fold<Vector, empty_policy_wrap<Base>,
128 inherit_with_base<Base, boost::mpl::_1 ,
129 policy_wrap<Base, boost::mpl::_2> >>::type {
130 typedef typename boost::mpl::
131 fold<Vector, empty_policy_wrap<Base>,
132 inherit_with_base<Base, boost::mpl::_1 ,
133 policy_wrap<Base, boost::mpl::_2> >>::type super;
136 typedef typename boost::mpl::at_c<Vector, 0>::type::const_iterator const_iterator;
141 return this->get<0>().begin();
146 return this->get<0>().begin();
152 return this->get<0>().end();
157 return this->get<0>().end();
163 return this->get<0>().size();
166 multi_policy_container(Base& base)
173 typedef typename boost::mpl::at_c<Vector, N>::type type;
180 return static_cast<policy_wrap<Base, T>&
>(*this).value_;
187 return static_cast<const policy_wrap<Base, T>&
>(*this).value_;
191 typename boost::mpl::at_c<Vector, N>::type&
194 typedef typename boost::mpl::at_c<Vector, N>::type T;
195 return static_cast<policy_wrap<Base, T>&
>(*this).value_;
199 const typename boost::mpl::at_c<Vector, N>::type&
202 typedef typename boost::mpl::at_c<Vector, N>::type T;
203 return static_cast<const policy_wrap<Base, T>&
>(*this).value_;
214 #endif // MULTI_POLICY_CONTAINER_H_ Copyright (c) 2011-2015 Regents of the University of California.
Table::const_iterator iterator
Copyright (c) 2011-2015 Regents of the University of California.