Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > specialization inside a template

Thread Tools

specialization inside a template

Posts: n/a
I am having trouble understanding why the following is forbidden:

template<class> struct A {
template<class>struct B;
template<>struct B<int>{};
template<>struct B<double>{};

while this is perfectly fine:

template<class> struct A {
template<class,int=0>struct B;
template<int i>struct B<int,i>{};
template<int i>struct B<double,i>{};

Well, I know the difference between the 2 cases, what I am interested
in is the reason that led to standardize things this way (I'd be happy
to learn it is just lack of interest).

Workarounds can be painful.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Full specialization of a member function template of a class template Dave C++ 4 06-04-2010 12:15 PM
Template specialization doesn't work after putting inside a namespace C++ 6 12-17-2008 08:17 AM
template function specialization inside template class possible? C++ 7 08-25-2006 11:01 PM
template specialization overriding non-specialization? Joseph Turian C++ 2 04-16-2006 02:46 PM
Specialization of a template within template David B. Held C++ 2 10-26-2003 11:59 AM