title: How to cheaply assign C-style array to std::vector?
body: <p>Currently I do the following:</p>
  
  <pre><code>// float *c_array = new float[1024];
  
  void Foo::foo(float *c_array, size_t c_array_size) {
    //std::vector&lt;float&gt; cpp_array;
  
    cpp_array.assign(c_array, c_array + c_array_size);
    delete [] c_array;
  }
  </code></pre>
  
  <p>How can I optimize this assigning? I would like not to perform elementwise copy but just swap pointers. </p>