Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-02-11 08:43:11


> epsilon should be a constant known at compile time?
> But is the compile unable to know this?

Static assertions require an integral-constant expression, and epsilon is
basically a runtime constant (at best it's a floating point constant).

BTW I don't believe you can portably use DBL_EPSILON etc in a static
assertion: you certainly can't use the DBL_* macros in preprocessor
directives as I've found to my cost already. A vendor is entitled to
implement this as:

#define DBL_EPSILON __dbl_eps
extern const double __dbl_eps;

> Other suggestions on how to achieve a compile-time warning here?

Not really, other than checking for numeric_limits<>::is_specialized.

John.


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