According to cppref:
constexpr iterator insert( const_iterator pos, const T& value );Return value
Iterator pointing to the inserted value.
Complexity
Constant plus linear in the distance between pos and end of the container.
Exceptions
If an exception is thrown when inserting a single element at the end, and T is CopyInsertable or std::is_nothrow_move_constructible::value is true, there are no effects (strong exception guarantee).
If pos is invalid, the documentation doesn't clearly describe the following issues:
- What's the return value?
- Whether an exception will be thrown?
So, my question is:
What if std::vector::insert(pos, value) with an invalid pos?