
Hi Joaquin, Sorry for the lack of info in my previous quote. I appreicate your affort to promptly help me. What I have is a non_unique which I carry to get all the keys.( I don't care about the elements) My guess is that key_extractor() returns a key_form_element, is quite redundant in my case. Regards Tal On 8/21/06, JOAQUIN LOPEZ MU?Z <joaquin@tid.es> wrote:
Hello Tal,
----- Mensaje original ----- De: Tal Agmon <tal.boost@gmail.com> Fecha: Domingo, Agosto 20, 2006 6:20 pm Asunto: [boost] [multi-index] key_value
Hi,
I am happy to work with multi_index library up till now I am able to operate successfully a 5 indices with my cranky msvc 6.5 comiler at work.
Remarkable, given the unstability of that old compiler.
I do have a naive question
Is it possible to retreive all key values from an N index_type container? and how can I do it?
I don't understand the question. What do you mean by "key value" and by "an N index_type container"? In case the following is somewhat related to your problem, here's how one can produce the key part of each element of a given key-based index (uncompiled, expect typos.)
// multi_index_t is some multi-index container. multi_index_t m; ...
// index N-th is key-based (for instance, ordered.) typedef nth_index<multi_index_t,N>::type index_t; const index_t& i=get<N>(m); for(index_t::const_iterator it=i.begin();it!=i.end();++it){ std::cout<<i.key_extractor()(*it)<<std::endl; }
This code uses the member function key_extractor(), which returns a copy of the internal key extractor, to extract the key part of a given element.
In case your question is not addressed by the snippet above, I'd appreciate if you could explain it a little more clearly, possibly stating what your final goal is.
Thank you for using Boost.MultiIndex,
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost