Is there a better way of appending a set to another set than iterating through each element ?
i have :
set foo ;
set bar
It is not a more efficient but less code.
bar.insert(foo.begin(), foo.end());
Or take the union which deals efficiently with duplicates. (if applicable)
set<string> baz ;
set_union(foo.begin(), foo.end(),
bar.begin(), bar.end(),
inserter(baz, baz.begin()));
You can insert a range:
bar.insert(foo.begin(), foo.end());