I have a base class
template<class T>
class Base
{
public:
    Base(T foo = T())
    {
        for(int i = 0; i < 10; i++)
            foos.push_back(foo);
    }
private:
    std::vector<T> foos;
}
and I have a derived class
class Derived : public Base<Bar>
{
public:
    Derived() : Base(Bar("somerandomparameter")) {}
}
What I want this to do, is to create a vector of 10 new Bars all with the provided constructor (whatever it is).
I thought of creating a custom copy constructor but this did not work as expected because it seems like the push_back method creates some more copies, at least my Bar constructor get's called more than 10 times.
The optimal solution to me would be something like passing a list of parameters as this is only creating the 10 objects I want.
...
Base(ParameterList l)
{
    for(int i = 0; i < 10; i++)
        foos.push_back(T(l));
}
...
But since this is a template class, I need that list to be adaptive to whatever type or number of parameters T needs. Is there a way of doing that or do you know of an even better way of doing what I want to do?
 
    