如果 std::vector::insert(pos, value) 的 pos 无效怎么办?

xml*_*lmx 2 c++ standards exception vector c++20

根据cppref

constexpr iterator insert( const_iterator pos, const T& value );

返回值

指向插入值的迭代器。

复杂

pos 与容器末端之间距离的常数加上线性。

例外情况

如果在末尾插入单个元素时抛出异常,并且 T 为 CopyInsertable 或 std::is_nothrot_move_constructible::value 为 true,则不会产生任何影响(强异常保证)。

如果pos无效,说明文档没有明确描述以下问题:

  1. 返回值是多少?
  2. 是否会抛出异常?

所以,我的问题是:

std::vector::insert(pos, value) 如果无效 怎么办pos