boost::multi_index_container vector-like O(1) time indexing question
I originally posted this to the wrong group, but I intended it for this
group.
I have a boost::multi_index question.
My current container has looked like the following for a very long time:
typedef
std::map
container_t;
This gives me the basics. But I cannot think of a way to add a
secondary index that would give me the O(1) vector-like indexing. A
use-case of the grammar I am after would be something like the following:
void useless_function(container_t& c)
{
for(container_t::iterator i = c.begin(); i!=c.end(); ++i)
print("key=%f\tval=%d\n",i->first,i->second);
for(index=0; index
On Sat, Aug 29, 2009 at 10:15 PM, zap.foster
[...] You can see that I want to be able to index into the container much like one would do with a vector. But I want my indexing to be O(1) and not O(n). [...]
Sounds like http://www.boost.org/doc/libs/1_39_0/libs/multi_index/doc/tutorial/basics.ht... or am I missing something? Just add a sequenced<> index. --DD
participants (2)
-
Dominique Devienne
-
zap.foster