Boost logo

Boost :

From: Mat Marcus (mmarcus_at_[hidden])
Date: 2001-12-15 17:36:08


At 11:52 PM +0200 12/15/01, Peter Dimov wrote:
>From: "Wilka" <wilka_at_[hidden]>
>> > See the end of the message for a starting point. This works
>> > on MSVC;
>>
>> Really? I get "fatal error C1001: INTERNAL COMPILER ERROR" :) MSVC6 SP5,
>> are you using 7?
>
>Yes. MSVC 6 must die. ;-)

Agreed. But until then... I don't have access to VC6 at the moment
but it is possible that this is just a case of the "dependent
template typedef bug". Did you try something like:

// EvalMF.h
#include "boost/mpl/mpl_config.h"
template <class QuotedMF, class B1, class B2>
struct EvalMF2
{
#ifdef BOOST_MSVC
  // based on the (non-conforming) MSVC trick from MPL

  template<bool>
  struct QuotedMF_VC : QuotedMF {};

  //illegal C++ which causes VC to admit that QuotedMF_VC
  //can have a nested template:

  template<>
  struct QuotedMF_VC<true>
  {template<class, class> struct apply; };

  typedef typename QuotedMF_VC<
    ::boost::mpl::detail::msvc_never_true<QuotedMF>::value
>::template apply <B1, B2>::type type;
  };
#else
   typedef typename QuotedMF::
        template apply <B1, B2>::type type;
#endif
};

template <class QuotedMF, class B1, class B2, class B3, class B4>
struct EvalMF4
{
#ifdef BOOST_MSVC
  // based on the (non-conforming) MSVC trick from MPL

  template<bool>
  struct QuotedMF_VC : QuotedMF {};

  //illegal C++ which causes VC to admit that QuotedMF_VC
  //can have a nested template:

  template<>
  struct QuotedMF_VC<true>
  {template<class, class, class, class> struct apply; };

  typedef typename QuotedMF_VC<
    ::boost::mpl::detail::msvc_never_true<QuotedMF>::value
>::template apply <B1, B2, B3, B4>::type type;
  };
#else
   typedef typename QuotedMF::
        template apply <B1, B2, B3, B4>::type type;
#endif
};

//end EvalMF.h

Then rewrite bind2:

// ...

// #Include "EvalMF.h"

template<class F, class A1, class A2> struct bind2
{
  typedef bind2 type;

  template<class B1 = _missing, class B2 = _missing, class B3 = _missing,
class B4 = _missing> struct apply
  {
   typedef typename EvalMF4<_bi::select<A1>,B1, B2, B3, B4>::type a1;
   typedef typename EvalMF4<_bi::select<A2>,B1, B2, B3, B4>::type a2;
   typedef typename EvalMF2<F, a1, a2>::type type;
  };
};


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