
6 Apr
2004
6 Apr
'04
7:13 a.m.
Thorsten Ottosen wrote:
I'd prefer to have on-fly container. Something like this:
std::copy( on_fly % 1 % 2 % 3, on_fly_end<int>(), back_inserter<int>(v));
Not as cool as v += 1, 2, 3; but might have some advantages.
What would the advantages be? This have advantage when the container is not available, only iterators range.
template<class Iter> void one_two_three(Iter begin, Iter end) { assert(distance(begin, end) >= 3); copy(on_fly % 1 % 2 % 3, on_fly_end<int>(), begin); } It has some serious problem, though. For example, in find(on_fly % 1 % 2 % 3, on_fly_end<int>(), 2); return value points to temporary. -- Alexander Nasonov Independent Developer and Consultant