title: Thread safety of const reference return of const method
body: <p>Consider this class:</p>
  
  <pre><code>#include &lt;vector&gt;
  
  class A {
  private:
      std::vector&lt;int&gt; m_vector;
  public:
      void insertElement(int i) {
          m_vector.push_back(i);
      }
      const std::vector&lt;int&gt;&amp; getVectorRef() const {
          return m_vector;
      }
  };
  </code></pre>
  
  <p>Is the method <code>getVectorRef</code> thread safe?</p>
  
  <p>Is it possible that during the return of <code>getVectorRef</code> another thread pops in and calls <code>insertElement</code>such that the member vector gets changed and the caller of <code>getVectorRef</code> gets a wrong const reference?</p>
  
  <p>Have the two const qualifiers(one for the vector and the other for the method) no meaning in the context of thread safety? </p>