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

后端 未结 5 1493
深忆病人
深忆病人 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:32

    I believe you are looking for std::max_element:

    The max_element() function returns an iterator to the largest element in the range [start,end).

提交回复
热议问题