From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-02-05 07:20:36
On Tue, 4 Feb 2003 13:03:05 -0300, "Fernando Cacciola"
>Dave Abrahams wrote:
>> On Tuesday, February 04, 2003 8:05 AM [GMT+1=CET],
>> Joel de Guzman <djowel_at_[hidden]> wrote:
>>> Yup, this works:
>>> #elif defined(__GNUC__) && (__GNUC__ < 3)
>>> // g++ 2.95.3 cannot take static_cast the casts,
>>> typedef integral_c<T, T(value + 1)> next;
>>> typedef integral_c<T, T(value - 1)> prior;
>> Hey, does that one work for Borland, too? Maybe we could get rid of the
>The conditionals for using 'N' instead of 'value' are still needed.
>The c-style cast works, though.
"needed" is a strong word :-) If you qualify the name:
typedef integral_c<T, (integral_c<T, N>::value) + 1 > next;
typedef integral_c<T, (integral_c<T, N>::value) - 1 > prior;
then Borland digests it. FWIW, my opinion is that conditionals should
be absolutely the last resort in this kind of situations and that
library authors should first experiment by rearranging the code in a
way that contents the maximum number of supported compilers. The
conditionals save the author's time in the first place, but waste both
the author's and the users' one in the long term as they complicate
maintenance, testing and understandability of the code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk