简体   繁体   中英

How to find where an element will be inserted into a std::map without actually inserting it

有没有一种方法可以轻松地找到将元素插入到std::map的迭代器,而无需实际插入元素?

The best you can do is use:

std::map::upper_bound() or
std::map::lower_bound()
to get the iterator positions where key is greater than or greater than or equal to a specific key value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM