Re: [Boost-users] [Iterators] Change in transform_iterator from1.31 to1.32?
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of David Abrahams Sent: Tuesday, July 26, 2005 5:41 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Iterators] Change in transform_iterator from1.31 to1.32?
If Nat were using the actual type of the bind expression as the first argument to transform_iterator, this wouldn't be a problem (except -- not sure if you care -- that it would be returned by value from the iterator). Presumably, the bind object has an appropriate non-reference nested result_type.
[Nat] I must be missing something here -- but I'm eager for enlightenment. boost::bind() is a runtime expression. I need to write a typedef for const_iterator before we get anywhere near that point. How can I use a type defined on the bind object for the typedef I need?
Nat, what you are doing looks _really_ inefficient. The result of make_transform_iterator is some iterator type that's very different from, but convertible to, your const_iterator type. Going through that extra layer using boost::function means you are doing a lot of extra copying -- and potentially, dynamic memory allocation -- whenever you ask for an iterator.
[Nat] I would be very happy to do it better, once I discover how.
"Nat Goodspeed"
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of David Abrahams Sent: Tuesday, July 26, 2005 5:41 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Iterators] Change in transform_iterator from1.31 to1.32?
If Nat were using the actual type of the bind expression as the first argument to transform_iterator, this wouldn't be a problem (except -- not sure if you care -- that it would be returned by value from the iterator). Presumably, the bind object has an appropriate non-reference nested result_type.
[Nat] I must be missing something here -- but I'm eager for enlightenment. boost::bind() is a runtime expression. I need to write a typedef for const_iterator before we get anywhere near that point. How can I use a type defined on the bind object for the typedef I need?
If the bind documentation doesn't tell you the type of that object (does it?), then officially you can't. Unofficially, you could pass the result of the bind expression to a function template that does something illegal on it, like template <class F> void show_me_the_type(F const& f) { f += "hello"; } and your compiler will probably show it to you. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Nat Goodspeed