All the stuff I've read about templates always refers to them as template declarations.

So with the following code segment:

template codeBlockTemplate(T, U)
{
    T a = 7;
    U b = 'z';
}

codeBlockTemplate!(int, char);  // error here

Microsof's Visual Studio IDE tells me <identifier> expected, ; found

But aren't templates instantiated at compile time? If so, isn't memory allocated at compile time, so in theory couldn't templates support code definitions?


Bonus question: Isn't a Zero-parameter template declaration pretty much worthless?

Thanks.






Reply via email to