title: How to initialize std::vector from C-style array?
body: <p>What is the cheapest way to initialize a <code>std::vector</code> from a C-style array?</p>
  
  <p>Example: In the following class, I have a <code>vector</code>, but due to outside restrictions, the data will be passed in as C-style array:</p>
  
  <pre><code>class Foo {
    std::vector&lt;double&gt; w_;
  public:
    void set_data(double* w, int len){
     // how to cheaply initialize the std::vector?
  }
  </code></pre>
  
  <p>Obviously, I can call <code>w_.resize()</code> and then loop over the elements, or call <code>std::copy()</code>. Are there any better methods?</p>