Relative Content

Tag Archive for c++templatestemplate-meta-programming

How to forward constructor parameters to a contained tuple when one of the tuple elements has a default constructor and another one doesn’t

I am trying to write a class that uses a std::tuple to store a bunch of objects with potentially different types. If the elements all have ctors that take some parameter, I can initialize the tuple from the container’s ctor correctly. However, if one of the elements only has a default ctor and the others do not, I am unable to construct the tuple. I get a compilation error.