on-internet
← Community

Filtering a std::set based on specific data

Stack Overflow ·

I have a std::set of a class which stores some master data. Below is how my set looks like: std::set<TBigClass, TBigClassComparer> sSet; class TBigClassComparer { public: bool operator()(const TBigClass s1, const TBigClass s2) const { //comparison logic goes here } }; Now I want to filter data in this set based on some fields of the TBigClass and store it in another set for manipulation. std::set<int>::iterator it; for (it=sSet.begin(); it!=sSet.end(); ++it) { //all the records with *it.some_integer_element == 1) //needs to be put in another set for some data manipulation } Could anyone tell m

Comments

Sign in or sign up to comment and upvote.

No comments yet.