How do I find the largest int in a std::set?

后端 未结 5 1494
深忆病人
深忆病人 2021-02-03 17:19

I have a std::set, what\'s the proper way to find the largest int in this set?

5条回答
  •  鱼传尺愫
    2021-02-03 17:29

    Sets are always ordered. Assuming you are using the default comparison (less), just grab the last element in the set. rbegin() might be useful.

提交回复
热议问题