Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-13 10:11:48


On Saturday 12 May 2001 08:48 pm, you wrote:
> I've tried out the latest (May 9th) version of the archive for
> function.hpp. Here's what I did when I tried to compile it.
>
> 1. I had to comment out the "template" qualifications when a template that
> came from within a class was being referenced. I use Metrowerks
> CodeWarrior Pro 5.3, which is a generation behind the latest (6.1). I
> don't know if CWP6.1 has the same problem. If it doesn't, should we bother
> coming up with a workaround?

None of the other CodeWarrior folks have mentioned such a problem, so it
seems specific to 5.3. I'm not sure if we should support older versions of a
compiler, given the large number of hacks and #ifdef's already required.

> 2. A new problem emerged due to the "nil_t" type. An object of this type
> can be converted to any (data) pointer, via a conversion operator that is a

T can be bound to a function type, so it works for both data and function
pointers.

> member template. CWP5.3 cannot handle such operators, even though it can
> handle non-template-based operators and other member template functions. I
> don't think even CWP6.1 fixes it, so we need a workaround strategy. This
> could include a BOOST_NO_CONVERSION_OPERATOR_TEMPLATES #define in
> <boost/config.hpp>.

In truth, function doesn't even use that conversion, so commenting it out
wouldn't hard function. However, nil is intended as a general replacement for
the usage of NULL and 0, so it needs to be able to convert to any pointer
type. Unfortunately, I can't think of any possible workaround, because we
can't go back and add an operator= for pointers :(.

If this problem is still around for more compilers, we have a real problem
:). The only workaround for a compile not supporting/using the templated
conversion operator is the evil:

#define nil 0
typedef const int nil_t;

This won't always work, unfortunately :(

I hope CW6.1 doesn't have this problem...

        Doug


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