foo (5) , foo <int> (5) ?
, T [ foo(5)].
You can leave the template arguments at the end, and not at the beginning or in the middle:
For instance:
template<typename T, typename U>
void foo(T t)
{
}
template<typename T, typename U>
void bar(U u)
{
}
int main()
{
foo<int>(5);
foo<int, int>(5);
bar<int>(5);
bar<int, int>(5);
}
source
share