Template Specialisation

Started by
3 comments, last by Chris Hare 20 years, 9 months ago
Just a quickie. Consider template class A {...} Can A be specialised as where X is any class via a single definition? That is, do all specialisation template arguments need to be known at compile time or can the templated arguments be templated themselves? I ask because I can specialise template A for instances A, that is a pointer type as the argument. Thanks in advance.
Advertisement
I don''t think I understand the question. Perhaps some <''s and >''s got messed up?
daerid@gmail.com
quote:Original post by Chris Hare
Consider

template <class L, class R> class A
{...}

Can A be specialised as <int, X> where X is any class via a single definition?


Not sure if that''s what you are asking, but you can partially specialize A with int as the first template parameter using a declaration such as


template <class R> class A<int,R>
{...}

Yes, there are missing < & >s for some reason, but spock answered the question anyway. Thanks spock.

Wizza Wuzza?
You''re welcome. Those characters will show up if you use HTML entities - replace < with &lt; and > with &gt;.

This topic is closed to new replies.

Advertisement