Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-28 09:14:47


A colleague of mine was recently playing around with STLPort's <limits>
(actually stl/_limits.[ch]) trying to get things like is_signed to act as
compile-time constants, when he discovered something which was (to my mind
at least) quite surprising: MSVC will treat static const bool members as
compile-time constants (at least under most conditions), even though it
won't let you define them in the class body. One reason I was surprised is
that boost headers traditionally have used enums for this purpose. Moreover,
the original Dinkum library (I don't have their updated library) does the
same thing. It seems to me that our code would be better/more portable if we
actually used static const XXX (i.e. whatever is called-for by the
specification) rather than enums where possible. On the other hand, this
raises the question of why numeric_limits<T>::is_signed is not a
compile-time constant on STLPort/MSVC. Anyone have insight into this?

-Dave


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