c++11 - C++ 11 Move Semantics and STL Containers -
regarding move semantics , containers:
i know stl containers take advantage of move when move operations defined in elements type. how know if element has defined move operations or not?
why don't stl containers invoke std::move() on elements anyway, regardless of whether element has defined move operations or not? i'm asking because know can invoke std::move() on objects if type not define move operations.
thank you.
long story short, that's do, calling std::move
without caring if able move or copy.
it's worth noting functions offering strong exception guarantee, such std::vector::resize
, call lesser known std::move_if_nothrow
instead of std::move
.
Comments
Post a Comment