Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-09-15 10:28:04


On Sep 15, 2003, at 12:46 AM, Eric Friedman wrote:

> I posted some time ago about what seemed to be a bug in Metrowerks's
> CodeWarrior 8.3 compiler that was standing in the way of complete
> functionality of the upcoming Variant library (namely reference
> content for
> variants). I have not yet found a workaround, but I have more precisely
> identified the problem.
>
> The problem can be reproduced by attempting to compile the code shown
> below.
> Note that this code successfully compiles on at least the following
> compilers: MSVC 7.1, gcc 2.95 and up, Borland 5.51, and Comeau 4.3 and
> up.
>
> Any help would be greatly appreciated. Also, it might be worthwhile
> introducing a new defect macro to the config library.

Thanks for the demo, that really helps.

Like Daniel, I recommend the enable_if pattern here, but I would do it
like:

   struct test_t
   {
       template <typename T>
       test_t(T&, typename enable_if<!is_const<T>::value>::type* = 0)
       {
       }

       template <typename T>
       test_t(T&, typename enable_if<is_const<T>::value>::type* = 0)
       {
       }
   };

-Howard


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