Reputation: 1764
Suppose there is a function taking iterator<B>
and I have some (iterable) collection of A
s.
void external_function(iterator<B> bit);
Furthermore I have a function to convert A
s to B
s.
B transform(A& a) { ... };
I would like some kind of wrapper iterator which iterates over all A
s and gives B
s instead.
iterator<B> transform(iterator<A> ait, UnaryOperator transformer);
Is there some function in boost that does that? Or do I have to write it myself?
Upvotes: 2
Views: 169
Reputation: 36896
Boost has boost::transform_iterator; I suppose this is what you're looking for.
Upvotes: 3