Skip to main content

Checkpoint: Copy & Move

Challenge on lesson: Checkpoint: Copy & Move

Implement class Sentence owning a std::vector<std::string> words_ (rule of three/five, deep semantics). Provide void add(std::string w), std::size_t size() const, and std::string joined() const returning words separated by single spaces. The test copies one Sentence, mutates the copy, and verifies independence, then moves a temporary into a vector.

Difficulty: intermediate

Back to lesson: Checkpoint: Copy & Move