
24 Jun
2008
24 Jun
'08
1:26 p.m.
Dean Michael Berris wrote:
Almost does it, but not necessarily. Constructing an instance of the transform iterator would require the instantiation of the counting_iterator as well.
template <class ResultType, class InputType> struct generator { typedef transform_iterator< function<ResultType(InputType)>, counting_iterator<InputType>
iterator; typedef iterator const const_iterator;
iterator begin() { return make_transform_iterator( counting_iterator<InputType>(), _function ); }; [...]
By using ranges instead of iterators, you can get that container-like behaviour (grouping of begin and end). However counting_range doesn't seem to be implemented yet.