C++ 23 · Classes, memory and templates
Move instead of copy
Transfer a resource to another object without copying it.
std::vector<int> big(1'000'000);
std::vector<int> other = std::move(big);
More classes, memory and templates commands
- Define a class
- Use polymorphism
- Own an object with unique_ptr
- Share ownership with shared_ptr
- Lock a mutex safely
- Write a function template
All classes, memory and templates commands · C++ 23 cheatsheet