Here are a couple of concise constructs that come in handy when debugging C++ code involving STL containers.
Output
The following line of code prints the contents of an STL container cont whose value_type is T to the std::cout stream, where each element is separated by a space.
#include <algorithm>
#include <iterator>
#include <iostream>
std::copy(cont.begin(), cont.end(), std::ostream_iterator<T>(std::cout, " "));