この問題に遭遇したとき、私は C++0x 可変個引数テンプレートを試していました:
template < typename ...Args >
struct identities
{
typedef Args type; //compile error: "parameter packs not expanded with '...'
};
//The following code just shows an example of potential use, but has no relation
//with what I am actually trying to achieve.
template < typename T >
struct convert_in_tuple
{
typedef std::tuple< typename T::type... > type;
};
typedef convert_in_tuple< identities< int, float > >::type int_float_tuple;
テンプレート パラメーター パックを typedef しようとすると、GCC 4.5.0 でエラーが発生します。
基本的に、パラメータパックを解凍せずにtypedefに「保存」したいと思います。出来ますか?そうでない場合、これが許可されていない理由はありますか?