Template params: decl vs instantiation syntax
Kagamin
spam at here.lot
Thu Oct 7 05:12:13 PDT 2010
Nick Sabalausky Wrote:
> > 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?
>
Aah, it's called Explicit Specialization. See factorial implementation at http://digitalmars.com/d/2.0/template-comparison.html
More information about the Digitalmars-d
mailing list