[C++-sig] Re: Re: map key
David Abrahams
dave at boost-consulting.com
Tue Jan 21 00:25:26 CET 2003
"Mike Rovner" <mike at bindkey.com> writes:
> "David Abrahams" <dave at boost-consulting.com> wrote in message
> news:uadhzfgpd.fsf at boost-consulting.com...
>> David Abrahams <dave at boost-consulting.com> writes:
>>
>> > I think it doesn't know about std::pair<const Key*,Value>, which is
>> > the iterator's value type ;-)
>
> Of cause, you are right!
>
>> > A Python map's iterator just iterates the keys, so you might need to
>> > build the iterator by hand if you want it to do the same thing.
>>
>> You could use the Boost transform iterator adaptor with std::select1st
>> to build an iterator over keys and expose it with class_<...>.range().
>
> I decided to leave them out. I already have keys(), values() and items(),
> so I can live without iter...().
Too bad; transform iterator adaptor with std::select1st + range()
would've been an easy and clean solution.
--
David Abrahams
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig
mailing list