0

I have a QList of SerialPortInfo objects. I want to sort it based on the objects' property portName.

I tried qSort, but that has been deprecated and it won't compile. I am trying std::sort but not working so far since not sure what to put at the ??? parameter. I see some examples of std::sort but seems not relevant to my case.

 std::sort(serialPortInfoList.first(),serialPortInfoList.end(),???)
GeneCode
  • 7,545
  • 8
  • 50
  • 85
  • Example of two ways to do it here: https://stackoverflow.com/questions/24913642/lambda-vs-function-for-sorting – Retired Ninja Sep 19 '17 at 00:26
  • 1
    `qSort` won't compile? My project is using very recent Qt 5.9 and just checked: nobody bothered replacing `qSort` with `std::sort`, though why not. – Alexander V Sep 19 '17 at 00:30
  • @AlexanderVX, it works thank you. I think there was some other error that made it cant compile. – GeneCode Sep 19 '17 at 01:55

0 Answers0