I have a long template function declaration:
template <typename T> void foo(lots ofargs, goin here, andeven more, ofthese arguments, they just, dont stop);
with no overloads. and I want to explicitly instantiate it. I can write (say for T
= int
):
template void foo<int>(lots ofargs, goin here, andeven more, ofthese arguments, they just, dont stop);
But I really don't want to copy that long declaration. I would have liked to be able to say something like:
template <typename T> using bar = decltype(foo<T>);
and then:
template bar<int>;
Now, the first line compiles (GCC 4.9.3), but the second line doesn't. Can I make it work somehow? Or can I use decltype()
some other way to avoid copying the declaration for the instantiation?
Note: I intentially used an example in which you can't deduce the type from just the arguments, since I want any solution to support this case as well.