I have a template function to do sth with type T
template <class T>
void EmplaceProcessor()
{
T* pProcessor = new T();
m_vItemProcessors.emplace_back(pProcessor);
}
If I want to implement a lot of types to emplace to the vector, just sth like:
template<class...A>
void EmplaceAllProcessor()
{
const int size = sizeof...(A);
for (int i = 0; i < size; ++i)
{
EmplaceProcessor<A[i]>(); //how to expand it?????
}
}
and I want to call EmplaceAllProcessor<P1, P2, P3>(); to emplace all types of processor
I want to call EmplaceAllProcessor<P1, P2, P3>(); to emplace all types of processor, How can it be?