c++ - Default type parameter error in template code -


1)template <class t = int, class u = double> //compiles  2)template <class t, class u =double> //compiles  3)template <class t = int, class u> //fails 

why 1 , 2 compile whereas 3 not?

for same reason why:

void f(int = 0, int); 

fails.

there no way use 3rd version default parameter:

template<class t = int, class u> class b { ... };  b<, short> var; // ??? no such syntax 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -