Template params: decl vs instantiation syntax

Nick Sabalausky a at a.a
Thu Oct 7 01:22:49 PDT 2010


"Kagamin" <spam at here.lot> wrote in message 
news:i8jps1$vhd$1 at digitalmars.com...
> Nick Sabalausky Wrote:
>
>> Template parameter syntax in C++/C#/etc:
>>     Declare: foo<bar>
>>     Instantiate: foo<bar>
>
> I thought, template instantiation in C++ is a little bit more complex like
> template<> class Foo<Bar>
>

Been awhile since I used C++, so I guess I don't know, but C# does like I 
described above. Ie:

class Foo<T> // Declare template
{}

class Bar
{
   Foo<int> f; // Instantiate template
}

It's the same basic syntax either way: "xxx<yyy>"

> If you instantiate a template explicitly, how do you differentiate between 
> declaration and instantiation?

Not sure what you mean here. Can you provide an example? 




More information about the Digitalmars-d mailing list