title: Passing parameters separated by commas to << operator
body: <p>I'm trying to accomplish something similar to <code>Eigen</code> advanced initialization for my container class.</p>
  
  <p>i.e. in <code>main</code>, I want to fill an object of type <code>DynamicArray</code> as follows:</p>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>// Create 3 x 3 Dynamic array and fill with 0's
  DynamicArray da(3, 3, 0);
  
  da &lt;&lt; 1, 2, 3,
        4, 5, 6,
        7, 8, 9;
  </code></pre>
  
  <p>The method I've used to try to accomplish this is:</p>
  
  <p><strong>DynamicArray.hpp</strong></p>
  
  <pre><code>template &lt;typename T&gt;
  class DynamicArray {
  
          // ...
  
  public:
  
          // ...
  
      template &lt;typename... Args,
                typename = typename std::enable_if&lt;ArgPackSameTruth&lt;
                                               std::is_convertible&lt;Args, T&gt;...&gt;::value,
                                               T&gt;::type
      &gt; void operator&lt;&lt;(Args... x) {
  
          typename std::vector&lt;T&gt; arg_vect{std::forward&lt;Args&gt;(x)...};
  
          std::cout &lt;&lt; arg_vect.size() &lt;&lt; "\n";
  
          // Load contents of arg_vect into *this...
  
          return;
      }
  }
  </code></pre>
  
  <p>When I compile <code>main.cpp</code>, I get a size of 1 for <code>arg_vect</code>, so only the first parameter is being taken in. How can I make sure all parameters are passed?</p>
  
  <p>Thanks!</p>