How to find next (by a single parameter) element in c++? (stl) [closed]
- by user2136963
I have n humans of THuman class
Each human has scored some points in one of two rounds. (score1 and score2)
Each human has its unique id. Score1 and 2 are also unique.
Besides, a human has a score_t=score1+score2, which can be the same for two of them.
I need to implement 6 variables to THuman which return id of a human with:
bigger score1
smaller score1
bigger score2
smaller score2
bigger score_t
smaller score_t
(if there are many humans those satisfy theese conditions, the one with smallest difference of corresponding parameter should be chosen (like score1 for 1 and 2))
In other words, it's some kind of storing 3 human sortings.
Two more functions I need should get argument x, set score1 or score 2 to x, and then refresh some of the 6 variables above.
If I needed sorting by only one variable, I would simply create set and defined and < operators for my class. But what is the solution for three of parameters? Is it possible to use STL here, or I should create my own lists/treaps?
__
Answer: How to update set of pointers c++?