hello all,
I am trying to update each value for a set<int> with a integer already defined in the function. I have been trying to use transform algorithm. I can do
void func{
// some stuff which calculates the value of num
int num=10;
transform(set1.begin(),set1.end(),set2.begin(),add)
}
int add(int val)
{
return( val + 2);
}
so this will update every value with 2 and add to set2,but i want to be able to do this by updating each value with "num"
I cant see a way round this. any suggestions?
thanks
I am trying to update each value for a set<int> with a integer already defined in the function. I have been trying to use transform algorithm. I can do
void func{
// some stuff which calculates the value of num
int num=10;
transform(set1.begin(),set1.end(),set2.begin(),add)
}
int add(int val)
{
return( val + 2);
}
so this will update every value with 2 and add to set2,but i want to be able to do this by updating each value with "num"
I cant see a way round this. any suggestions?
thanks