Practice ยท 1 of 2
Prove the move happened
Implement class Payload owning an inline static-style counter trio via function-local statics: copies(), moves(), alive(). Constructor increments alive(); copy ctor increments copies(); move ctor increments moves() and must NOT copy any buffer; destructor decrements alive(). The test moves a Payload into a vector and checks moves() > 0 and copies() == 0.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Rule of Three and move semantics