Monday, October 18, 2010

Swap Trick

Assuming that you don't care about the cost of reallocations, the swap trick a good way to empty a container.

Reference: More Exceptional C++ by Herb Sutter. Addison-Wesley, 2001, p. 52.

No comments:

Post a Comment