Boost logo

Boost :

From: Raoul Gough (RaoulGough_at_[hidden])
Date: 2003-11-17 14:46:02


"John Maddock" <john_at_[hidden]> writes:

>> Under MSVC6, BOOST_NESTED_TEMPLATE expands to "template" instead of
>> being empty. For instance, I have code where the following works on
>> MSVC6, but only after I redefine BOOST_NESTED_TEMPLATE to be empty:
>>
>> typedef typename traits_by_category <max_category>
>> ::BOOST_NESTED_TEMPLATE traits<Iterator>::type type;
>>
>> The config/compiler/visualc.hpp header never defines
>> BOOST_NO_MEMBER_TEMPLATE_KEYWORD, even though MSVC6 has limited
>> support for member templates, and doesn't accept the template keyword
>> in this usage. Is this a config bug?
>
> Maybe, can you provide a test case please (or supply a modified version of
> the existing test in libs/config/test/boost_no_mem_tem_keyword.cxx).

Yes, a very good idea. Actually, looking at
libs/config/test/boost_has_vc6_mem_templ.cxx there is the following at
the start:

#ifndef BOOST_NESTED_TEMPLATE
#define BOOST_NESTED_TEMPLATE template
#endif

and then

   typedef typename ifoo::BOOST_NESTED_TEMPLATE nested<double> bound_t;
   typedef typename bound_t::other other;

Which seems to indicate that MSVC6 does require the "template" keyword
in this situation. However, I tried modifying the first three lines
quoted above to the following:

#undef BOOST_NESTED_TEMPLATE
#define BOOST_NESTED_TEMPLATE

and this also compiles using MSVC6.5 (i.e. service pack 5) which
indicates that the keyword is actually optional here. Maybe this
wasn't the case with earlier releases?

>
> BTW, I think several existing compilers choke when you try to put multiple
> scope operators in the one typedef, for example the existing test splits a
> typedefs like this up:
>
> typedef typename ifoo::template nested<double> bound_t;
> typedef typename bound_t::other other;
>
> Whether that's the issue here I don't know.

I see. I've now tried out some different workarounds in my original
code, and the problem with BOOST_NESTED_TEMPLATE under MSVC6 seems to
have disappeared. I don't really understand what changed to fix this,
but it seems that the MSVC6 config is right after all. Apologies for
the false alarm.

-- 
Raoul Gough.
(setq dabbrev-case-fold-search nil)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk