The problem that is being solved is deducing types from template non-type parameters.
Given:
template<typename T> void foo(T);
template<typename T, T> void bar();
it is possible to deduce T
for foo
(for example, foo(10)
will result in T
being deduced to be int
), but it is not possible to deduce T
for bar
(bar<10>()
will simply not compile, you have to write it as bar<int,10>()
).
N3601 proposes fixing this by introducing the syntax:
template<using typename T, T> void bar();
which will allow bar<10>()
to compile and cause the type T
to be deduced.