Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-06-22 15:25:09


On Sun, 22 Jun 2003 22:01:19 +0200, Terje Slettebø wrote:

> Ok. So maybe an extra level of indirection, as in your code (and
> Kenniston's) may be preferable. I was wondering what was the point with
> it. :)
>
> Another thing, are the ADD_OPERATOR macro in your code necessary? It
> compiles fine without it on Intel C++ 7.1.

The GCC doesn't work without the operators, as it doesn't implicitly tries
to satisfy float*pi_t by casting pi_t to float to use float*float. I
think this is OK as the language can go for two ways:

a) define float*float and use a promotion/conversion for, say, float*int.
b) define several operators float*float, float*int, ...

if it's b), the compiler cannot cast pi_t to float as it doesn't know
whether to select float*float or float*int, thus it fails. Maybe a
question for the language lawyers over at csc++ to find out what's
correct.

>> Also, I'm not sure whether it's standard compliant code.
>
> I think it is. It specialises a member. What could be the problem with
> this? As you say, errors are caught at link time.

I think that you have to declare the specialization in the class'
definition, not just outside. But I may be wrong here and I haven't
checked it. Note I didn't say it's illegal, just that *I* am not sure it's
legal ;)

Regards, Daniel


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