template < typename T, int Size = 0 > void FileWriteVar ( ofstream* File, T Value )
NOW SOLVE IT.
... Not really. I never really practiced much with templates so I kinda' expected some sort of error to happen, but for some reason when I try to compile, I get the following error (MS VC++):
error C4519: default template arguments are only allowed on a class template
Now, I thought that you could use a default argument for any kind of template argument? This happens with all my other templates as well, but only those with default arguments. And no, this isn't a declaration. I know better than to try to do that with a template.
I think it's pretty evident that you can't, since the compiler is giving an error. I don't see how it could be clearer.
I can't find a reason for this in TC++PL. Actually, I find an example of the opposite:
I'm not saying that I don't understand the error. I'm saying that it goes against what I learned in the documentation, which is why I was asking about it.
The error is actually generated at the ending-bracket of the function definition. I don't know if that makes a difference, but I thought I might as well say it.
I had a reason before... I can't remember what it was. -_-' Good point. I'm beginning to think that some of my errors are just from stupidity. :| I began adding it as an argument instead, but stopped and put that back for some reason.