struct Comparer
{
int val;
Comparer(int v):val(v) {}
bool operator()(int lhs, int rhs) const {
if (rhs == val) return false;
if (lhs == val) return true;
return lhs < rhs;
}
};
To create an instance of the std::set
that orders based on Comparer
:
std::set<int, Comparer> instance( Comparer(2010) );