(accelerated C++) chapter managing memory
<p>I am going  through accelerated C++  and I am stuck in exercise 10.3 and I have literally no clue how to even start. I would like to mention here that its not homework exercise and I am reading it just to gain confidence in C++ . The question is shown below .</p>

<blockquote>
  <p>Rewrite the median function from §8.1.1/140 so that we can call it
  with either a vector or a built-in array. The function should allow
  containers of any arithmetic type.</p>
</blockquote>

<p>The code for above question is given below</p>

<pre><code>template &lt;class T&gt;
 T median( vector&lt;T&gt; v)
 {
    typedef typename vector&lt;T&gt;::size_type vec_sz;
     vec_sz size = v.size();
     if( size == 0 )
     {
         throw domain_error(" median of an empty vector");
     }
     sort( v.begin(), v.end() );
     vec_sz mid = size /2;
     return size%2 == 0 ? ( v[mid]+v[mid+1])/2 : v[mid] ;
 }
</code></pre>

<p>I have no clue what to do next. Any help or criticism will be beneficial to me.
Thanks and regards</p>
