Jump to content
  • Advertisement

Archived

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

Chris Hare

Template Specialisation

This topic is 5561 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
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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!