Is the std::set iteration order always ascending according to the C++ specification?

前端 未结 5 826
遥遥无期
遥遥无期 2020-12-05 06:42

Here http://www.cplusplus.com/reference/stl/set/ I read that std::set in C++ is \"typically\" implemented as a tree (red-black one?) and it is sorted.

I could not un

5条回答
  •  生来不讨喜
    2020-12-05 07:09

    The default comparator is less, so the set will be ordered ascending. To change this you can specify another existing or custom comparator as a template argument.

提交回复
热议问题