The template parameter type on std::ostream_iterator should match the value_type on a.
Prints each element on a separate line; you can change the delimiter between elements by replacing "\n", BUT be warned: the delimiter will appear after the last element as well
'... Returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings.'