I want to use a type alias so that I can be given a template argument if necessary.
template<typename T, unsigned d>
struct value
{
T a[d];
};
template<typename T=float>
using val=value<T, 2>;
int main()
{
val v;
val<int> w;
return 0;
}
g ++ for some reason does not approve:
test.cpp: In function ‘int main()’:
test.cpp:12:13: error: missing template arguments before ‘v’
val v;
^
test.cpp:12:13: error: expected ‘;’ before ‘v’
Do not the default template arguments work with 'using'? If so, why doesn't he talk about it on the line, is the default argument specified?
source
share