short examples of patterns and idioms in C++