Почему это даже не разрешено?
Код: Выделить всё
auto key1 = /* some key */;
auto key2 = /* another key that is greater than `key1` */
auto hint = map.lower_bound(key1);
if (/* some check depending on `hint`*/) {
map.insert_or_assign(hint, key1, 3023);
auto second_hint = map.lower_bound(key2); // we'd rather use `hint` here!
if (/* some check depending on `hint`*/) {
auto b = map.insert_or_assign(second_hint, key2, 199);
}
}
< /code>
Как мы можем сделать эту логику оптимально и не переписывая ее полностью. Проблема заключается в том, что неспособность передать подсказку Lower_bound Пожалуйста, поделитесь идеями о том, как это сделать.>
Подробнее здесь: https://stackoverflow.com/questions/796 ... ower-bound
Мобильная версия