C++ sorting and keeping track of indexes

后端 未结 15 2152
甜味超标
甜味超标 2020-11-22 10:01

Using C++, and hopefully the standard library, I want to sort a sequence of samples in ascending order, but I also want to remember the original indexes of the new samples.<

15条回答
  •  孤独总比滥情好
    2020-11-22 10:16

    If it's possible, you can build the position array using find function, and then sort the array.

    Or maybe you can use a map where the key would be the element, and the values a list of its position in the upcoming arrays (A, B and C)

    It depends on later uses of those arrays.

提交回复
热议问题