0
在如下所示的模板中,如何從另一個更復雜的元組中填充元素?使用另一個元組中的元素填充元組
template<typename... Ts>
struct foo {
std::tuple<std::vector<Ts>...> tuple;
foo() {
//populate tuple somehow
//assume that no vector is empty
}
void func() {
std::tuple<Ts...> back_tuple; // = ...
//want to populate with the last elements ".back()" of each vector
//how?
}
};
我找不到任何元組的push_back機制,所以我不知道如何使用模板循環技巧來做到這一點。此外,我無法找到任何類似於模板的initializer_list來收集我的值,然後傳遞到新的元組中。有任何想法嗎?