title: Which const with which reference will change the argument and create an const object?
body: <p>I have this template call:</p>
  
  <pre><code>int ia[] = { 9, 2, 5, 1, 8 };
  const sav&lt;int&gt; sia( ia, sizeof( ia ) / sizeof( ia[ 0 ] ) );
  </code></pre>
  
  <p>And I want to sort  the <code>ia</code>, and create <code>sia</code>. I tried like this:</p>
  
  <pre><code>template&lt;typename T&gt;
  class sav {
  public:
      sav(T&amp; givenArray,size_t size) {
           for( int idx = 0; idx &lt; size; ++idx){
              data.push_back(givenArray[idx]);
           }
           std::sort(data.begin(), data.end());
           for(int idx =0; idx&lt;size; ++idx){
              givenArray[idx] = data.at(idx);
           }
      }
  private:
      std::vector&lt;T&gt; data;
  };
  </code></pre>
  
  <p>But I don't know where I have to write <code>const</code> in this case to get this code to work.</p>