• Advertisement

Archived

This topic is now archived and is closed to further replies.

Template Specialisation

This topic is 5349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
I don''t think I understand the question. Perhaps some <''s and >''s got messed up?

Share this post


Link to post
Share on other sites
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>
{...}

Share this post


Link to post
Share on other sites
Yes, there are missing < & >s for some reason, but spock answered the question anyway. Thanks spock.

Wizza Wuzza?

Share this post


Link to post
Share on other sites
You''re welcome. Those characters will show up if you use HTML entities - replace < with &lt; and > with &gt;.

Share this post


Link to post
Share on other sites

  • Advertisement