template
class Ordered_Map { private: struct item { item(K k,V v) : first(k),second(v) {} K first; V second; }; typedef multi_index_container< item, indexed_by< random_access<>, ordered_unique
> > > container; container c;
public:
V operator[](const K& key) {
c.insert(c.end(), item(key,2));
return (??); } void begin() {
//for (container::const_iterator i = c.begin(); i != c.end(); ++i) //std::cout << i->first << " - " << i->second << std::endl; } };
I have some problems; The operator[] is not yet complete.
Have you red the link I posted: http://www.boost.org/doc/libs/1_48_0/libs/multi_index/doc/tutorial/technique...
But the real problem is the begin() method, it should return a container::const_iterator, but if I use the signature: *container::const_iterator begin()* { return c.begin(); }
I get an error :-(
Maybe you try to return the iterator of the second index? Note that container::const_iterator is the iterator of the 1st index.