title: Print vector of vectors to ostream
body: <p>Please consider the following code. I'm trying to output a vector of vectors to an ostream.</p>
  
  <pre><code>#include &lt;iterator&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  template&lt;typename T&gt;
  std::ostream &amp;operator &lt;&lt;(std::ostream &amp;os, const std::vector&lt;T&gt; &amp;v) {
      using namespace std;
      copy(v.begin(), v.end(), ostream_iterator&lt;T&gt;(os, "\n"));
      return os;
  }
  
  int main() {
      using namespace std;
      vector&lt;string&gt; v1;
      cout &lt;&lt; v1;
      vector&lt;vector&lt;string&gt; &gt; v2;
      cout &lt;&lt; v2;
      return 0;
  }
  </code></pre>
  
  <p>The statement where I output a vector of strings works. The one where I output a vector of vectors of strings doesn't. I'm using g++ 4.7.0. I've tried w/ &amp; w/o the -std=c++11 flag. In C++11 mode, it gives me this line in the half-page of errors.</p>
  
  <pre><code>error: cannot bind 'std::ostream_iterator&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt;, char, std::char_traits&lt;char&gt; &gt;::ostream_type {aka std::basic_ostream&lt;char&gt;}' lvalue to 'std::basic_ostream&lt;char&gt;&amp;&amp;'
  </code></pre>
  
  <p>I don't think I understand what it means. Could someone explain to me? I more or less know what an rvalue reference is, but I don't see why <code>std::basic_ostream&lt;char&gt;</code> wouldn't bind to <code>std::basic_ostream&lt;char&gt;&amp;&amp;</code>. Maybe I don't know it well enough. And is there a better way to do this?</p>
  
  <p>Thanks in advance.</p>