I have created a template class which takes two plain template parameters (like int or double) and have derived several other classes from it:
template <typename A, typename B>
class IClassBase {...}
template <typename B>
class Derived1Class : public IClassBase<std::string, B> {...}
template <typename B>
class Derived2Class : public IClassBase<std::string, B> {...}
I need to design a structure which would allow compiler to build a std::tuple based on list of template types and their parameters (B type in code snippet above).
vector<Derived1Class<int>> v1;
vector<Derived1Class<double>> v2;
vector<Derived2Class<bool>> v3;
vector<Derived2Class<string>> v4;
for (size_t i = 0; i < v1.size(); i++)//assuming all vectors have same size or could also use min(v1.size(), ..., v4.size())//
{
make_tuple(v1[i], v2[i], v3[i], v4[i]);
}
You can also make_tuple in situ into a container of the correct type directly with emplace_back or an iterator adaptor