title: Correct way to return stl map by reference / Is this behavior well defined?
body: <p>I have 2 classes and one of them has <code>map&lt;string, vector&lt;string&gt; &gt;</code>I want to be able to use this in other class. Here is my code:</p>
  
  <pre><code>class a
  {
      map&lt;string, vector&lt;string&gt; &gt; m;
      public:
      const map&lt;string, vector&lt;string&gt; &gt; &amp; get()
      {
          return m;
      }
  };
  
  class b
  {
      a obj;
      public:
      void test()
      {
          map&lt;string, vector&lt;string&gt; &gt; m= obj.get();
          // and then print
      }
  };
  
  int main(int argc, char ** argv)
  {
      b bobj;
      bobj.test();
      return 0;
  }
  </code></pre>
  
  <p>Is the way I returned reference to map in <code>class a</code> correct? It worked,but I just want to confirm if it was done properly / I got lucky / any other comments about the code.</p>
  
  <p>Thank you for your help.</p>