A little hard to phrase in a question so I will use an example. Lets say I do:
generate(myvec.begin(), myvec.end(), func())
Can I have it so that func() can read the index that generate is up to such that:
int func()
{
if(index<2)
return 1;
else
return 2;
}
such that myvec[0]=1, myvec[1]=1, myvec[2]=2, myvec[3]=2,..., myvec[N]=2
?