如何在不实际插入的情况下找到元素将插入std::映射的位置
How to find where an element will be inserted into a std::map without actually inserting it
有没有一种方法可以轻松地找到一个迭代器,在该迭代器中,元素将被插入到std::map
中,而无需实际插入元素?
你能做的最好的事情就是使用:
std::map::upper_bound()或
std::map::lower_bound()
以获取key大于或大于或等于特定键值的迭代器位置。
相关文章:
- 将重物插入std::map
- 在基于范围的 for 循环期间插入 std::list 的后面
- 插入 std::set 作为 std::map 的键
- 通过构造函数插入 std::map
- 将唯一指针插入std::映射
- 无法使用带有 std::move 的自定义删除器插入 std::unique_ptr
- 如何在声明时将对象插入 std::map
- 在这种情况下,插入 std::map 可能会失败?
- 如何在 C++11 中插入 std::map?
- 将 2D 数组插入 std::vector 时"cannot convert from 'const GLfloat [12]' to '_Objty'"错误消息
- 将排序范围插入 std::set 并带有提示
- 查找并插入-STD :: MAP C
- 使用类方法插入STD :: MAP
- C - 将值插入std :: map时
- 插入std :: basic_ostream实例化输出时的内存故障
- 如何将对象插入std::vector
- 用于插入 std::unordered_set 的 3D 间坐标的唯一键
- 如何使用迭代器插入std ::列表
- SegFault将插入std :: vector的成员函数插入std :: vector
- 在插入时插入std :: MAP中的模板类