I was trying to encapsulate a boost multiindex in a class usable as std::
map.
This is code:
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.
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 :-(
If I use container::const_iteraton inside the method begin() as type..it
work as type, but it don't work as returned type of begin()!
--
View this message in context: http://boost.2283326.n4.nabble.com/Container-with-insertion-order-tp4097717p...
Sent from the Boost - Users mailing list archive at Nabble.com.