C
Christian Gruber
dear NG,
I have a problem sorting the values of a container,
multimap<int, pair<int, double> > map;
where the key element is the first column
and part of the value is the second column.
1 2 1.4
1 0 2.3
2 3 3.2
2 2 0.7
3 1 0.4
3 3 4.2
3 2 2.3
4 0 ...
now, I need to sort the container according to the first + second column:
1 0 2.3
1 2 1.4
2 2 ...
2 3
3 1
3 2
3 3
4 0
..
when using
stable_sort(map.begin(), map.end(), bigger())
whit
class bigger
{
public:
bool bigger()(iter I1, iter I2)
{
return ((*I1).second).first < ((*I2).second).first
}
};
I get numerous errors and can't find my way through.
so my question is, whether the concept is right in principle
and I just made some typo errors or whether I have to handle
the problem completely different... any proposals?
Best Regards,
Christian
I have a problem sorting the values of a container,
multimap<int, pair<int, double> > map;
where the key element is the first column
and part of the value is the second column.
1 2 1.4
1 0 2.3
2 3 3.2
2 2 0.7
3 1 0.4
3 3 4.2
3 2 2.3
4 0 ...
now, I need to sort the container according to the first + second column:
1 0 2.3
1 2 1.4
2 2 ...
2 3
3 1
3 2
3 3
4 0
..
when using
stable_sort(map.begin(), map.end(), bigger())
whit
class bigger
{
public:
bool bigger()(iter I1, iter I2)
{
return ((*I1).second).first < ((*I2).second).first
}
};
I get numerous errors and can't find my way through.
so my question is, whether the concept is right in principle
and I just made some typo errors or whether I have to handle
the problem completely different... any proposals?
Best Regards,
Christian