title: How to put variadic arguments to vector of elements with inheritance?
body: <p>I use c++ 17 and have the next set of classes</p>
  <pre><code>class A {
  public:
      virtual void fun() = 0;
  };
  
  class B : public A {
  public:
      void fun() override {
      }
  };
  
  class C : public A {
  public:
      void fun() override {
      }
  };
  </code></pre>
  <p>I would like to have a function <em><strong>process</strong></em> that accepts variable list of variables and returns a vector of <strong>A</strong> (a base class)</p>
  <pre><code>std::unique_ptr&lt;B&gt; b1(new B());
  std::unique_ptr&lt;B&gt; b2(new B());
  std::unique_ptr&lt;C&gt; c1(new C());
  std::unique_ptr&lt;C&gt; c2(new C());
  
  auto vec = process&lt;A&gt;(b1, b2, c1, c2);
  </code></pre>
  <p>For using <strong>initializer_list</strong> i have to know exact type of passed arguments.</p>
  <p>I do not see a way to use viriardic templates because I do not know how to  unpack parameters correctly.</p>
  <pre><code>template &lt;typename T, typename... Rest&gt;
  std::vector&lt;std::unique_ptr&lt;T&gt;&gt; process(std::unique_ptr&lt;T&gt; t, std::unique_ptr&lt;Rest&gt;... rest) {
    std::vector&lt;std::unique_ptr&lt;T&gt;&gt; A = process&lt;std::unique_ptr&lt;T&gt;&gt;(rest...);
    std::vector&lt;std::unique_ptr&lt;T&gt;&gt; B = process(t);
    std::vector&lt;std::unique_ptr&lt;T&gt;&gt; AB;
    AB.reserve(A.size() + B.size());
    AB.insert(AB.end(), A.begin(), A.end());
    AB.insert(AB.end(), B.begin(), B.end());
    return AB;
  }
  
  template &lt;typename T&gt;
  std::vector&lt;std::unique_ptr&lt;std::unique_ptr&lt;T&gt;&gt;&gt; process(std::unique_ptr&lt;T&gt; t) {
    return std::vector&lt;std::unique_ptr&lt;T&gt;&gt;{t};
  }
  
  template &lt;typename T, typename... Rest&gt;
  std::vector&lt;std::unique_ptr&lt;T&gt;&gt; process(std::unique_ptr&lt;Rest&gt;... rest) {
    std::vector&lt;std::unique_ptr&lt;T&gt;&gt; vector;
    auto va = {rest...};
    for (auto el : va) {
      process(el);
    }
    return vector;
  }
  </code></pre>
  <p>Is there the simple way to implement a function that accepts variable arguments and returns a vector?</p>