i had declared a set variable outside a function globally.
std::set s1;
std::set s2;
std::set interse
This code compiles for me.
Perhaps your compiler is complaining about your underscore usage? Since it says:
Variable
result
is not a structure.
Whereas you declared _result_
.
See What are the rules about using an underscore in a C++ identifier? (as recommended by Mat).
std::set_difference(s1.begin(), s1.end(), s2.begin(), s2.end(),std::inserter(_result_, _result_.end()));
Add type parameter in inserter definition:
std::set_difference(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter< std::set<std::string> >(_result_, _result_.end()));