std::map, custom comparator's design constraints

后端 未结 3 1049
一个人的身影
一个人的身影 2021-01-23 11:56

I have been trying defining a custom comparator for std::map container.

The question is : can I relay on == and != operators or would that break strict weak order ? Am I

3条回答
  •  孤街浪徒
    2021-01-23 12:25

    This is unacceptable, string weak ordering means that A < B and B < A shall not be true at the same time. std::map relies on this to establish both ordering and equality of the keys

提交回复
热议问题