title: How to include different number of objects at compile time with variadic arguments in the initializer list?
body: <p>This is an extension of previous question (<a href="https://stackoverflow.com/questions/63792255/how-to-include-different-number-of-objects-at-compile-time-in-the-initializer-li">Link</a>)</p>
  <p>I need to include a different number of objects depending on the provided 'define' and with different ctor parameters. First parameter is an 'index' of object from zero and to (NUMBER-1), other parameters are optional.</p>
  <p>So far I don't have issues when only single 'index' parameter is presented but I'm still straggling to add optional parameters <code>Args... args</code>.</p>
  <p>That's how I'm trying to do that. Let's say we are gonna to instantiate 2 following classes</p>
  <pre><code>class Output
  {
  public:
      explicit Output(uint32_t idx) : m_idx(idx) { printf(&quot;ctor: %u\n&quot;, m_idx); };
  private:
      uint32_t m_idx = -1;
  };
  
  class Input
  {
  public:
      explicit Input(uint32_t idx, std::string name) : m_idx(idx), m_name(name) { printf(&quot;ctor: %u [%s]\n&quot;, m_idx, m_name.data()); };
  private:
      uint32_t m_idx = -1;
      std::string m_name;
  };
  </code></pre>
  <p>There are 2 templates to instantiate with sequential indexing</p>
  <pre><code>template&lt;typename T, typename... Args, typename TInts, TInts... I&gt;
  constexpr auto MakeArrayHelper(Args... args, std::integer_sequence&lt;TInts, I...&gt;)
  {
      return std::array&lt;T, sizeof...(I)&gt;{ (I)..., std::forward&lt;Args&gt;(args)... };
  }
  
  template &lt;typename T, size_t Count, typename... Args, typename BaseType = uint32_t&gt;
  constexpr auto MakeArray(Args... args)
  {
      return MakeArrayHelper&lt;T&gt;((args)..., std::make_integer_sequence&lt;BaseType, Count&gt;());
  }
  </code></pre>
  <p>And I wanted to instantiate classes like that</p>
  <pre><code>    auto outputs = MakeArray&lt;Output, 5&gt;();
      auto inputs = MakeArray&lt;Input, 3&gt;(std::string(&quot;Analog&quot;));
  
      expanded into:
  std::array&lt;Output, 5&gt; = { Output{0}, Output{1}, Output{2}, Output{3}, Output{4} };
  std::array&lt;Input, 3&gt; = { Input{0, &quot;Analog&quot;}, Input{1, &quot;Analog&quot;}, Input{2, &quot;Analog&quot;} };
  </code></pre>
  <p>This leaves me with a compilation error: <code>could not deduce template argument for 'TInts'</code></p>
  <p>Could you help me with understanding what I'm doing wrong.
  Thanks.</p>