Which operator needs to be overridden in order to use std::set in the C++ code?

前端 未结 4 694
滥情空心
滥情空心 2021-01-27 09:34

This is an interview question.

Referring to the sample code, which one of the operators needs to be overridden in order to use st

4条回答
  •  面向向阳花
    2021-01-27 10:19

    To speed up the enforcement of no duplicate elements and generally checking if element is in its usually some sort of a tree and only needs operator <. (The only usage of less is enforced by the standard, the rest is just the avarage implementation)

提交回复
热议问题