I guess this is a simple question. I need to do something like this:
std::set<int> s1, s2;
s1 = getAnExcitingSet();
transform(s1.begin(), s1.end(), std::back_inserter(s2), ExcitingUnaryFunctor());
Of course, back_inserter
doesn't work since there's no push_back.
std::inserter
also needs an iterator? I haven't used inserter so I'm not sure what to do.
Does anyone have an idea?
Of course, my other option is to use a vector for s2, and then just sort it later. Maybe that's better?