c++11 - C++ 11 Move Semantics and STL Containers -


regarding move semantics , containers:

  1. 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?

  2. 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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -