Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2000-07-19 11:34:34

David Abrahams wrote

For things like is_specialized which need to be compile-time constants the
VC6 workaround (sortof - more of a bodge - already used for numeric_limits
by Plauger's Dinkumware Library - packaged in a macro _STCONS(ty, name, val))

is to use an enum:

                enum {is_specialized = true}; // Bodge for MSVC 6
                // returns an int not a bool, so outputs
                // "math_const<long> is specialised 0"

                // need to use
                // static_cast<bool>(int_math_const<int>::is_specialized)
                // to get bool and output:
                // "math_const<long> is specialised false"

How much longer must we wait for a Standard compiler from MS???

Daryle Walker suggested

        static const bool is_specialized() { return false; }

which does correctly return the expected bool

but this is different from numeric_limits and requires a call


instead of

         boost::math_const<long>::is_specialized // as numeric_limits

I feel the is_specialized is useful, but to be different from numeric_limits
is unacceptable.

So with regret I propose to follow the current MS limits bodge, or leave it
out for now.

At least with a static_cast<bool> the code will always be correct and never
need changing.

Other views or suggestions?


Dr Paul A. Bristow, hetp Chromatography
4 Victoria Road, Wilmslow, Cheshire SK9 5HN UK
Phone +44 1625 520193 FAX & Voicemail +44 1625 252495
email mailto:pbristow_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at