I started to make a program using the factory pattern. The way it work it's we have the template function construct which allocate a pointer and return a reference to the value. We have the possibility to send a Container class to add the pointer in the list inside the container before returning the reference. The container is a template class. The goal is to add constructed object to each object list it is inherited. Here's a sample of code:
1 2 3 4 5 6 7
template<class T, class S>
static T& construct(Container<S>& c)
{
T* ptr = new T;
c.addData(ptr);
return *ptr;
}
But waht I wan tot do is something like that:
1 2 3 4 5 6 7 8 9
template<class T, class ...S>
static T& construct(Container<S>& ...c)
{
T* ptr = new T;
//???
return *ptr;
}
What can I put to make this code working, I am searching for a while and it's very blocking .