Thanks Joaquín

On Wed, Mar 18, 2015 at 3:45 PM, Joaquin M Lopez Munoz <joaquin@tid.es> wrote:
Nick Stokes <randomaccessiterator <at> gmail.com> writes:

>
> Q1:  Is there a builtin in way in MI to iterate over keys rather
> than elements? I.e. the iterator's value type will be that of the
> key, not the element. 

No, there's none. Some iterator adaption is needed as you mention
below.

> Q2:  Is there a way to obtain the type of key extractors given a
> multi index container?  (it is related to Q1, as this sort of a
> thing could be passed to boost::transform iterator to obtain an
> alternative answer for Q1)

  auto beg=boost::make_transform_iterator(
             foos.get<1>().begin(),foos.get<1>().key_extractor()),
       end=boost::make_transform_iterator(
             foos.get<1>().end(),foos.get<1>().key_extractor());

  std::copy(
    beg,end,std::ostream_iterator<std::string>(std::cout," "));

Joaquín M López Muñoz
Telefónica
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users