What are move-aware containers in C++? I know std::vector is a move-aware container. But I don't know what move-aware means.
The word move-aware container occurs in this context:
std::unique_ptris commonly used to manage the lifetime of objects, including:
...
* as the element type in move-aware containers, such asstd::vector, which hold pointers to dynamically-allocated objects (e.g. if polymorphic behavior is desired)
It means that the container knows how to handle move-only types. std::unique_ptr is a move-only type: it cannot be copied. This implies that a container holding objects of move-only types must itself be move-only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With