What I want to do is make a variadic class template that instantiates (as a member variable) a std::tuple of objects, one entry in the tuple for each type in the parameter pack of the variadic template. There is one wrinkle: the tuple is not composed of the raw types directly, but rather a map of them:
template <typename... Ts>
class Bag
{
// This is fine:
template <typename T>
using TypedMap = std::map<std::string, T>;
// This is the tricky bit (obviously wrong as written):
std::tuple<TypedMap<T>, TypedMap<...>> Storage;
};
I'm having an end-of-week mental block on the best approach for this. I'm close to just defining my own recursive template instead of using std::tuple directly, and writing the glue by hand. Any better suggestions?
↧