469,578 Members | 1,214 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Explicit and partial template specialization nested in classes.

Dear all,

the following code is illegeal (but compiles with MSVC 7.1):

// *** illegal ***
struct outer0 {
template<typename inner_var>
struct inner { };

template<>
struct inner<void> { };
};
// ***

but is the following legal (compiles with g++, comeau, MSVC7.1) ?

// *** legal ***
struct outer0 {
template<typename inner_var, typename hack = void>
struct inner { };

template<typename hack>
struct inner<void,hack> { };
};
// ***

Example copied from:
http://lists.debian.org/debian-gcc/2.../msg00015.html

There I found as well:
In an explicit specialization declaration for a member of a class
template or a member template that appears in namespace scope, the
member template and some of its enclosing class templates may remain
unspecialized, except that the declaration shall not explicitly
specialize a class member template if its enclosing class templates
are not explicitly specialized as well.


but it does not tell if its legal :(.

Regards,
Patrick
Jul 22 '05 #1
0 1316

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Paul MG | last post: by
9 posts views Thread by Philip Lawatsch | last post: by
2 posts views Thread by Shekhar | last post: by
4 posts views Thread by wakun | last post: by
6 posts views Thread by wkaras | last post: by
reply views Thread by greek_bill | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.