jeudi 5 février 2015

Transform/map iterator to iterator

Suppose there is a function taking iterator<B> and I have some (iterable) collection of As.



void external_function(iterator<B> bit);


Furthermore I have a function to convert As to Bs.



B transform(A& a) { ... };


I would like some kind of wrapper iterator which iterates over all As and gives Bs 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?


Aucun commentaire:

Enregistrer un commentaire