sftrabbit / CppPatterns-Patterns

A repository of modern C++ patterns curated by the community.
Creative Commons Zero v1.0 Universal
1.43k stars 223 forks source link

Added swap samples #44

Closed DarkerStar closed 9 years ago

DarkerStar commented 9 years ago

I added two swap samples. The first is for swapping values - it demonstrates how to use ADL-enabled swapping. The second is for swapping containers - it demonstrates the difference between swapping the values of a container (via swap_ranges) and swapping the containers wholesale.

sftrabbit commented 9 years ago

Great samples. Thanks very much. I reworded the descriptions a bit because I felt they repeated a few things and could be cut down without affecting anything. I also changed the swap values sample to use std::strings instead of ints (just seems a bit more substantial). The revised samples are here.

DarkerStar commented 9 years ago

Both good points! Glad I could help.