gpt4 book ai didi

c++ - vector::insert 的异常安全保证是什么?

转载 作者:可可西里 更新时间:2023-11-01 16:15:39 25 4
gpt4 key购买 nike

我想知道,std::vector::insert 的异常安全保证究竟是什么? ?我对这个函数的单参数和范围重载都感兴趣。

最佳答案

在 C++11 23.3.6.5 中给出了确切的保证:

If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move assignment operator of T or by any InputIterator operation there are no effects. If an exception is thrown by the move constructor of a non-CopyInsertable T, the effects are unspecified.

关于c++ - vector::insert 的异常安全保证是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19532448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com