title: Initialize std::vector in class's initializer list
body: <p>I'm not sure if I should ask this at StackOverflow or at CodeReview. But because I couldn't find a similair problem, I'm posting it here.</p>
  
  <p>ATM I'm optimizing the code of a simple image manipulation application. </p>
  
  <p>One of the targets is to give all the convolution effect classes their respective matrix as their private variable. Because const-correctness this wasn't done earlier, but the quickfix to solve the introduced problems with const-correctness wasn't sparely with memory and cpu-cycles. </p>
  
  <p>So I decided to init the convolutionMatrix at class-initializiation-level with a <code>std::vector&lt;std::vector&lt;double&gt;&gt;</code> since creating dozens of constructors to make each initialisation with <code>std::array&lt;std::array&lt;double&gt;,\d+&gt;,\d+&gt;</code> possible, is inefficient. </p>
  
  <pre><code>BlurFilter::BlurFilter() : ColorEffect(), convolutionMatrix(
  std::vector&lt;std::vector&lt;double&gt;&gt;{
      std::vector&lt;double&gt;{ 0.0, 0.0, 1.0, 0.0, 0.0 },
      std::vector&lt;double&gt;{ 0.0, 1.0, 1.0, 1.0, 0.0 },
      std::vector&lt;double&gt;{ 1.0, 1.0, 1.0, 1.0, 1.0 },
      std::vector&lt;double&gt;{ 0.0, 1.0, 1.0, 1.0, 0.0 },
      std::vector&lt;double&gt;{ 0.0, 0.0, 1.0, 0.0, 0.0 }
  } )
  {
  }
  </code></pre>
  
  <p>However. the application breaks at runtime in the Matrix constructor with an <code>std::out_of_range</code>-exception with the what()-message: </p>
  
  <blockquote>
    <p>what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)"</p>
  </blockquote>
  
  <p>Aka multidimensionalVector.size() is somehow 0.</p>
  
  <pre><code>Matrix::Matrix( const std::vector&lt;std::vector&lt;double&gt;&gt;&amp; multidimensionalVector )
  {
      this-&gt;xLength = multidimensionalVector.size();
      this-&gt;yLength = ( *multidimensionalVector.begin() ).size();
      this-&gt;values = multidimensionalVector;
  }
  </code></pre>
  
  <p>Honestly I don't understand why the size of the multidimentsionalVector is zero at that moment at all since I'm passing an initialized vector of vectors which could be -as shown- copy-constructed (or move-constructed) over to the values-variable of the Matrix class. Changing multidimensionalVector copy-by-value don't make the difference. </p>
  
  <p>Could someone explain where and/or what is going wrong here?</p>
  
  <p>(PS: I'd prefer answers written in own words (aka in Plain English) instead of citing directly from the C++ standard documents because of the used vague and confusing academic/scientific language).</p>