I'm a little confused as to what is required regarding calling templated functions in C++11, where default values are supplied for the template arguments.
For example, say I have the following templated function
template <class T = double> void foo()
{
/* Do something */
}
and I want to call it somewhere in my code. Are all of these valid calls?
foo(); //Is this OK?
foo<>();
foo<int>();
It compiles fine with GCC 4.7.2, but I'm not sure if it's strictly correct C++. I guess my uncertainty may come from the requirement to use empty angle brackets <>
when creating an instance of a templated class using the default template, as described here:
but I presume in my case having the function brackets ()
is the critical difference?