Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Example: std::swap. The basic swap template swaps two values a and b by creating a temp copy of a, assigning a = b, and assigning b = temp. How can you extend it for your own types? For example, let’s say you have your own type Widget in your own namespace N:
namespace N {
class Widget { /* ... */ };
}