Boost logo

Boost :

From: Michael D. Borghardt (michael_at_[hidden])
Date: 2004-01-04 09:09:12


When I followed iy throught the debugger the min and max values were
SCHAR_MIN
and SCHAR_MAX which are -128 and 127 respectively.
>
> What is the representation range of a signed char on your platform?
>
> --

struct greater_than_type_max<false, false>
{
    // What does the standard say about this? I think it's right, and it
    // will work with every compiler I know of.
    template <class X, class Y>
    static inline bool check(X x, Y)
        { return static_cast<X>(static_cast<Y>(x)) != x; }
};

Here is converts 255 to -1 and then converts -1 to 255 and then compares
to 255.

Whan I test using an unsigned int as input to cast then 255 to -1 and then
converts -1 to 4294967295 and the exception occurs.


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