
Hi People,
Does anybody know if the code below, which relocates an interator to the
end() of an index, is legal? I tried delving into the multi_index code but
it is over my head.
I ask this because begin() is typically valid as an iterator, but end()
never is. The code does appear to work.
Also, would it be expensive? I think relocating in a sequenced index is
about as expensive as swapping pointers, but I'm not sure.
The code:
typedef multi_index_container<
CacheEntry,
indexed_by <
ordered_unique<
composite_key<
CacheEntry,
member
cache_t; cache_t d_cache;
// i is given and a valid iterator to the composite key typedef cache_t::nth_index<2>::type sequence_t; sequence_t& sidx=d_cache.get<2>(); sequence_t::iterator si=d_cache.project<2>(i); sidx.relocate(sidx.end(), si); // does this work? -- http://www.PowerDNS.com Open source, database driven DNS Software http://netherlabs.nl Open and Closed source services