Is std::vector::push_back permitted to throw for any reason other than failed reallocation or construction?

帅比萌擦擦* 提交于 2019-12-05 02:15:33

Well, it kind of depends on the allocator you are using.

Apart from the allocator, the only thing you can rely on is that push_back() and push_front() are guaranteed to be noop if an exception is thrown (23.1-10). The standard definitely doesn't forbid the push_back() from throwing exceptions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!