By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,296 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,296 IT Pros & Developers. It's quick & easy.

Inability to explicitly specialize a template class within another non-specialized template class

P: n/a
jn
Hi everyone,

I was trying to implement a design when I've found what seems a
limitation of standard C++. I can't specialize an inner class in this
way:

template <class ARG>
template <>
class Outer<ARG>::Inner<int>
{
//...
};

Actually, I was doing something more complex, in which the explicit
specialization was not on 'int', but on Outer<ARG>, so actually I was
trying to provide an explicit specialization for the case when the
argument to the inner template matched the outer one.

I will be working around this with a kludge, performing several
fully-explicit specializations for each of he different ARG's involved
(there are only 2 now and there will be 4 or 5 later on). But, I'd like
to know whether there is any construct in C++ by which I can detect
matching template arguments and provide a specialization in that case
-- maybe that way I'd be able to use a better hack^H^H^H^H workaround.

Thanks in advance,

J

Feb 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
jn@ngedit.com wrote:
I was trying to implement a design when I've found what seems a
limitation of standard C++. I can't specialize an inner class in this
way:

template <class ARG>
template <>
class Outer<ARG>::Inner<int>
{
//...
};

[..]


Yes, to explicitly specialise a member you need to first explicitly
specialise the outer template. That's a requirement of the language.

V
--
Please remove capital As from my address when replying by mail
Feb 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.