
2 May
2011
2 May
'11
12:41 p.m.
The same, but a bit shorter: #include <string> #include <boost/multi_index_container.hpp> #include <boost/multi_index/indexed_by.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/member.hpp> #include <boost/multi_index/composite_key.hpp> using namespace boost::multi_index; struct record { std::string str_; }; struct test { public: typedef composite_key<record, member<record, std::string, &record::str_>
key;
typedef multi_index_container<record, indexed_by<ordered_non_unique<key> >
container;
void fail_to_compile() { container c; std::string val = "abcd"; c.equal_range(val); } };