Archived

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

Chris Hare

Template Specialisation

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
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