[C++-sig] Re: Re: Re: map key

David Abrahams dave at boost-consulting.com
Thu Jan 23 19:57:27 CET 2003

"Mike Rovner" <mike at bindkey.com> writes:

> "David Abrahams" <dave at boost-consulting.com> wrote in message
> news:u8yxfe74p.fsf at boost-consulting.com...
>> "Mike Rovner" <mike at bindkey.com> writes:
>> > 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.
> Not so clean, though. :(
> std::select1st
> "This function object is an SGI extension; it is not part of the C++
> standard." (http://sgi.com/tech/stl/select1st.html)
> MSVC7 std:: doesn't have it.

It's trivial to write your own, or you can use Boost.Bind to build one:


> Nevertheless should it be like that
> ...
> .def("__iter__", range<>(
>   boost::make_transform_iterator(&StdMap::begin,std::select1st),
>   boost::make_transform_iterator(&StdMap::end,std::select1st)
> )
> ?
> And how I can insert ptr() call inside that iterator; with return policy?

I'm confused; why would you want to?  There's no pointer involved.

                       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