|
Boost : |
From: John Torjo (john.lists_at_[hidden])
Date: 2003-11-17 11:09:49
Hi Raoul,
The fact that BOOST_NESTED_TEMPLATE expands to "template" under MSVC6
is CORRECT.
The (stupid) compiler chokes when the nested class is relative to to a template
param. I've discovered this bug a few days ago.
The workaround is to derive from a class that actually defines a dummy traits
class, and from the traits class itself. Then, you can access the traits class
directly. Something like:
Original code was:
template< class adaptor_type, class r_type>
class r_adaptor_finder0 : public adaptor_type {
public:
typedef typename adaptor_type::template adapt_range0< r>::type
new_container;
typedef crange< new_container> type;
};
The current code is:
struct vc6_adaptor_finder_workaround_base {
private:
template< class r> struct adapt_range0 {};
};
template< class adaptor_type, class r>
class r_adaptor_finder0 : public adaptor_type
#ifdef BOOST_RTL_WORKAROUND_VC6
,private ::boost::rtl::detail::vc6_adaptor_finder_workaround_base
#endif
{
public:
// FIXME this might not work on other compilers
typedef typename adapt_range0< r>::type new_container;
typedef crange< new_container> type;
};
Please write to me directly if you need more info.
Best,
John
Raoul Gough wrote:
> 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?
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk