The "as easy as" part I could not work out -- ie, adapting the above function to work with any <kind> of vector.
In exactly the same way as you would adapt any other function to work with any kind of `std::vector<???>'. That it is an operator is meaningless.
Soma
Code:
template
<
typename element_F
, typename allocator_F
>
std::ostream& operator << (std::ostream& os, const std::vector<element_F, allocator_F>& v) {
typename std::vector<element_F, allocator_F>::const_iterator it = v.begin(), end = v.end();
while(it != end) {
os << (*it++) << std::endl;
}
return os;
}