boost phoenix lambda library problem: stealing elements std::vector
i recently ran problem i guess boost::lambda boost::phoenix assistance solve, nonetheless i means syntax right i another way. i wanted mislay elements "strings" reduction certain length another container.
this initial try:
std::vector<std::string> strings = getstrings();
std::set<std::string> others = getothers();
strings.erase(std::remove_if(strings.begin(), strings.end(), (_1.length() < 24 && others.find(_1) == others.end())), strings.end());
how i finished adult doing this:
struct discard
{
bool operator()(std::set<std::string> &cont, const std::string &s)
{
relapse cont.find(s) == cont.end() && s.length() < 24;
}
};
lines.erase(std::remove_if( lines.begin(), lines.end(), boost::bind<bool>(discard(), old_samples, _1)), lines.end());
Comments
Post a Comment