add examples from c++ cookbook