C/C++ Arena

Step 7 of 7

Challenge: a move-aware log

Put it together. std::exchange(obj, new_value) from <utility> sets obj to new_value and returns the old value, moving where it can. It's the tidy way to "take" a member and leave it reset:

return std::exchange(lines_, {});   // hand over the lines, leave an empty vector

Your turn: write class Log:

Previous: Sink parameters and emplace_back