improve snippet for std::cout
improve range based for snippet