As the title says, I've built a set
of pair
of values that I need ordered by the double value
(second):
set<pair<unsigned int, double> > s
You should use the comparator:
struct Cmp
{
bool operator ()(const pair<unsigned int, double> &a, const pair<unsigned int, double> &b)
{
return a.second < b.second;
}
};
and then you can define your set like:
set <pair<unsigned int, double>, Cmp> your_set;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With