C++20 中是否有assign_or_inserter/insert_or_assigner?

NoS*_*tAl 4 c++ stdmap c++20

std::inserter 遇到的问题是,如果键已经存在,它会调用 map 的 insert 为 noop。有std::map::insert_or_assign,但我找不到使用它的插入器。

C ++ 20中有这样的东西吗?

注意:我知道我可以从 SO/互联网上的某个地方 c/p 它,我对 STL/boost 解决方案感兴趣,而不是从某个地方的 c/p 实现。

cig*_*ien 6

不,没有相应的插入器使用insert_or_assign. 事实上,措辞明确表示只有 3 个这样的函数:

back_inserter、front_inserter 和 inserter 是使插入迭代器脱离容器的三个函数。