パラメータパック全体の内部メンバーにアクセスする簡単な方法はありますか? 次のコードがあるとしましょう
#include <iostream>
class A {
typedef int type;
constexpr static type C = 5;
};
class B {
typedef unsigned type;
constexpr static type C = 6;
};
template <class T1, class ... TList>
std::ostream & printer(std::ostream & out, T1 t1, TList ... plist) {
out << t1 << " ";
return printer(out, plist...);
}
template <class T1>
std::ostream & printer(std::ostream & out, T1 t1) {
return out << t1 << std::endl;
}
template <class ... TList>
std::ostream & proxy(std::ostream & out, TList ... plist) {
return printer(out, std::forward<TList::type ...>(plist::C ...));
}
int main(int argc, const char * argv[])
{
proxy(std::cout, A(), B());
return 0;
}
プロキシ関数で plist のメンバー変数をアンパックしてプリンターに渡したい。パラメータリストを反復せずにこれを行う簡単な方法はありますか?