How to Construct a vector of Tuples and Sort them like Pair?

Правка en3, от I_am_Heisenberg, 2018-05-01 00:09:04

Hi! Suppose, I have several integer elements like this:

(3 9 1), (1 5 2), (2 8 3), (1 4 4), (1 6 5), (1 5 6).

Now I want to sort the elements like vector of pairs are sorted. Only difference is that instead of 2 keys we have 3 keys here. After sorting the elements will look like:

(1 4 4), (1 5 2), (1 5 6), (1 6 5), (2 8 3), (3 9 1).

Is there any STL or other techniques to achieve this? I found out about "Tuples" but having some problems to understand this well. Can you guys help me in any way please? May be by providing useful links or Explaining the process.

Thanks.. :)

UPD: I got my ans here: https://stackoverflow.com/a/50106878/6928946

Теги pair, tuple, #sorting

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский I_am_Heisenberg 2018-05-01 00:09:04 76
en2 Английский I_am_Heisenberg 2018-04-30 20:35:18 9 Tiny change: ' I have set of integer e' -> ' I have several integer e'
en1 Английский I_am_Heisenberg 2018-04-30 20:33:52 661 Initial revision (published)