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 me an effective way to accomplish this? I do not have any libraries installed so solutions detailing use of boost would not help.
Update: I am working on C++98 environment.
Thank you for reading!
TBigClass
really is a big class, useconst &
in theoperator()
. Taking this by value is no a good idea.