title: Passing the pointer to the first element of a vector if any
body: <p>I have a function taking double* </p>
  
  <pre><code>void funct(double*); 
  </code></pre>
  
  <p>and I have a vector: </p>
  
  <pre><code>std::vector&lt;double&gt; myVec; 
  </code></pre>
  
  <p>how should I correctly and safely call funct(myVec)?  </p>
  
  <p>not safe: </p>
  
  <pre><code>funct(&amp;myVec[0]);
  funct(&amp;*myVec.begin());
  </code></pre>
  
  <p>not nice to be read:</p>
  
  <pre><code>funct( myVec.empty()? NULL : &amp;myVec[0]);
  funct( myVec.empty()? NULL : &amp;*myVec.begin());
  </code></pre>
  
  <p>any suggestion? </p>
  
  <p>What's the standard approach? </p>