Sort 2 dimensional c array with std::sort

前端 未结 2 419
南笙
南笙 2021-01-15 17:13

I cannot seem to sort a 2 dimensional c array with std::sort. I can however sort a one dimensional array. This is in a case where I am being handed a c array in a c++ progra

2条回答
  •  攒了一身酷
    2021-01-15 17:44

    std::sort() requires the objects it's used to sort to be MoveAssginable.

    Arrays are not MoveAssginable (nor assignable at all).

    Try using an array of structures or std::pairs instead.

提交回复
热议问题