С++ - Как я могу получить доступ к элементам пар, помещенным в вектор, через шаблон Variadic ⇐ C++
-
Anonymous
С++ - Как я могу получить доступ к элементам пар, помещенным в вектор, через шаблон Variadic
I need to call the C class object like this -
int main() { C c1; C c2; } I have this code so far -
template class A { ..... }; template class B { ..... }; template struct Pair // wrap a generic type { pair p; } template class C { tuple v; // every time the class and type will differ?? public: void func() { v.push_back(//all P in sequence); //access the 1st and 2nd element of each pair in vector } }; How can I push all P in sequence and then access the elements of each pair in class C?
If there is a fault in the above approach, then what other way I can use to be able call class C object like mentioned above?
Источник: https://stackoverflow.com/questions/727 ... riadic-tem
I need to call the C class object like this -
int main() { C c1; C c2; } I have this code so far -
template class A { ..... }; template class B { ..... }; template struct Pair // wrap a generic type { pair p; } template class C { tuple v; // every time the class and type will differ?? public: void func() { v.push_back(//all P in sequence); //access the 1st and 2nd element of each pair in vector } }; How can I push all P in sequence and then access the elements of each pair in class C?
If there is a fault in the above approach, then what other way I can use to be able call class C object like mentioned above?
Источник: https://stackoverflow.com/questions/727 ... riadic-tem
Мобильная версия