c++ - When std::vector reallocate its memory array, is copy constructor or move constructor used? -


when std::vector reallocate memory array, kind of copy / move constructor used copy / move elements new houses?

if move-constructor exists , noexcept used. otherwise copy-constructor used.

using move-constructor might throw undesirable might happen objects moved new storage , exception prevents rest of objects being moved.

the cppreference.com site if object non-copyable , has non-noexcept move constructor, use move-constructor, "unspecified behaviour" if exception thrown. guess means elements may lost vector.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -