>596
きみのやりたいことは、関数化しなくても、
std::cout << str;
std::copy( vec.begin(), vec.end(), std::ostream_iterator( std::cout, " \n") );
でやれたはず。