In the sample below I'm trying to alias a template parameter pack basically.
It's not possible in the standard so I found people work around the limitation with a tuple or empty templated struct. However my situation seems different because I don't have an argument parameter type pack to match...
(I know this sample seems stupid but it's a minimal PoC. In the codebase the typelist gets a lot longer and this would really be useful.)
#include <iostream>
#include <tuple>
template<typename T>
void f(T t)
{
std::cout << "templated f()" << std::endl;
}
template<>
void f(int t)
{
std::cout << "specialized f()" << std::endl;
}
template<typename A, typename B>
void fn()
{
f(A());
}
template<int, char>
void fn()
{
int a;
f(a);
}
// Can't seem to define this correctly.
//using MyType = std::tuple<int, char>()::type;
int
main(int, char**)
{
fn<char, char>();
// I have
fn<int, char>();
// I want some alias;
//fn<MyType>();
return 0;
}
references;