Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-01-23 16:56:05


John Maddock wrote:
>
> There is something strange about numeric_limits here, the following code
> compiles OK:
>
> # include <limits>
> template <class T> struct int_check
> {
> BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_specialized == false);
> };
> typedef int_check<int> check;
>
> There's something strange going on with gcc and Borland C++ as well: they
> appear not to care one way or another (I can't get the test to fail with
> these compilers).

That's because int_check<int> is never instantiated. "typedef" just defines
another name for it, but does not cause instantiation. If you remove
the "typedef", thus defining a variable "check", it works (i.e. the compiler
gives an error, at least my gcc and Comeau C++ on Linux do).

Jens Maurer


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