I was experimenting with C++0x variadic templates when I stumbled upon this issue:
template < typename ...Args >
struct identities
{
typedef Args t
This is a variation of GManNickG's neat partial specialization trick. No delegation, and you get more type safety by requiring the use of your variadic_typedef struct.
#include
template
struct variadic_typedef {};
template
struct convert_in_tuple {
//Leaving this empty will cause the compiler
//to complain if you try to access a "type" member.
//You may also be able to do something like:
//static_assert(std::is_same<>::value, "blah")
//if you know something about the types.
};
template
struct convert_in_tuple< variadic_typedef > {
//use Args normally
typedef std::tuple type;
};
typedef variadic_typedef myTypes;
typedef convert_in_tuple::type int_float_tuple; //compiles
//typedef convert_in_tuple::type int_float_tuple; //doesn't compile
int main() {}