MSVC 6 usage of typename keyword

Hi, sorry if this is a stupid question but I haven't found an answer in the mail archive. I can hardly believe that it hasn't been asked before. Everywhere in the boost libs I see code like namespace boost { // Just a simple "envelope" for non-type template parameters. Useful // to work around some MSVC deficiencies. template <typename T, T n> struct non_type { }; } The problem is the "typename T" part. MSVC 6 does not compile this, it wants "class T". How do I get around this MSVC deficiency (I have SP 5 installed, at least my admin says so)? Isn't there something like BOOST_TEMPLPAR_TYPENAME_KEYWORD that is defined to be equal to class for MSVC <= 6 (and maybe others) an equal to typename for able compilers? Cheers, Christoph

Your snippet compiles fine here (MSVC++ 6.0 with Service Pack 5), so your problem must lie elsewhere. MSVC++ 6.0 has a non-conforming treatment of "typename", but in different contexts than yours. For example: template <typename Iterator> struct iterator_wrapper { typedef typename Iterator::value_type value_type; // here }; In the example, typename is required though MSVC++ 6.0 can live without it. In other contexts the situation is worse, cause typename is required but MSVC++ 6.0 won't accept it. For these situations there's a portability macro called BOOST_DEDUCED_TYPENAME defined in <boost/config.hpp>. But this is not meant to be used where you describe. HTH Joaquín M López Muñoz Telefónica, Investigación y Desarrollo christoph@familie-koegl.de ha escrito:
Hi,
sorry if this is a stupid question but I haven't found an answer in the mail archive. I can hardly believe that it hasn't been asked before.
Everywhere in the boost libs I see code like
namespace boost {
// Just a simple "envelope" for non-type template parameters. Useful // to work around some MSVC deficiencies.
template <typename T, T n> struct non_type { };
}
The problem is the "typename T" part. MSVC 6 does not compile this, it wants "class T". How do I get around this MSVC deficiency (I have SP 5 installed, at least my admin says so)? Isn't there something like BOOST_TEMPLPAR_TYPENAME_KEYWORD that is defined to be equal to class for MSVC <= 6 (and maybe others) an equal to typename for able compilers?
Cheers,
Christoph _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
christoph@familie-koegl.de
-
Joaquín Mª López Muñoz