#include #include #include #include #include #include #include #include #include #include using namespace boost::assign; using namespace boost::flyweights; using namespace boost::multi_index; typedef std::vector path_t; typedef flyweight scenario_t; struct entry { entry(const scenario_t& scenario):scenario(scenario){} scenario_t scenario; // payload }; typedef multi_index_container< entry, indexed_by< ordered_non_unique > > > entry_container_t; struct parent_t:scenario_t { parent_t(const scenario_t& s):scenario_t(s){} }; struct children { bool operator()(const parent_t& p,const scenario_t& s)const { return std::lexicographical_compare( p.get().begin(),p.get().end(), s.get().begin(),s.get().begin()+std::min(p.get().size(),s.get().size())); } bool operator()(const scenario_t& s,const parent_t& p)const { return std::lexicographical_compare( s.get().begin(),s.get().begin()+std::min(p.get().size(),s.get().size()), p.get().begin(),p.get().end()); } }; void count_children(const entry_container_t& c,const scenario_t& s) { std::cout<<"children in /"; BOOST_FOREACH(const std::string& str,s.get()){ std::cout<