title: C++11 initializer_list constructor with header and cpp file for custom vector class
body: <p>I'm doing a school project where I am to construct a custom vector class.
  And the class should be able to initialize vectors in a few different ways.
  I've got stuck with this initializer_list initialization of the vector.</p>
  
  <p>The only values wich are allowed as elements are unsigned int.</p>
  
  <p>header</p>
  
  <pre><code>#include &lt;initializer_list&gt;
  class myvec {
  private:
      unsigned int *arr; //pointer to array
      std::size_t n; //size of myvec
  public:
      myvec(); // Default contructor
      myvec(std::size_t size); // Creating a vec with # of element as size
      myvec(const myvec&amp;); // Copy constructor
      myvec(const initializer_list&lt;unsigned int&gt;&amp; list);
  </code></pre>
  
  <p>cpp</p>
  
  <pre><code>#include "myvec.h"
  #include &lt;initializer_list&gt;
  
  myvec::myvec() {
      arr = new unsigned int[0];
      n = 0;
  }
  
  myvec::myvec(std::size_t size) {
      arr = new unsigned int[size];
      n = size;
  }
  
  myvec::myvec(const myvec&amp; vec) {
      arr = new unsigned int[vec.n];
      n = vec.n;
      for (int i = 0; i &lt; vec.n; i++) {
          arr[i]=vec.arr[i];
      }
  }
  
  myvec::myvec(const std::initializer_list&lt;unsigned int&gt; list) {
  
  }
  </code></pre>
  
  <p>What I don't understand is how the constructor should be written for it to work? Been trying to find answers on internet for a long time without success.</p>
  
  <p>I want to call the initializer_list constructor from another c++ file as
  test.cpp</p>
  
  <pre><code>myvec a = {1,2,3,4};
  </code></pre>