|
Boost : |
From: Michael Stevens (michael_at_[hidden])
Date: 2002-10-16 01:18:10
Hi everyone,
Jens has been making a few changes to Boost random recently. These
include a lot of additional static asserts such as
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_signed);
BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_integer);
#endif
The wrapper should disable the assert for nasty compilers. However...
VC7 seems to have a bizare problem with these. The macro is not define,
because in the normal case the compile time constants do work. However
if the limits type parameter is a template parameter they don't work.
This little example shows the problem.
// Test VC7 Limit
#include <boost/limits.hpp>
#include <boost/static_assert.hpp>
BOOST_STATIC_ASSERT(std::numeric_limits<int>::is_integer); // OK
template <class IntType>
class fred
{
static const bool x = std::numeric_limits<IntType>::is_integer;
BOOST_STATIC_ASSERT(std::numeric_limits<int>::is_integer); // OK
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer); //
FAILS on definition of template!
};
This little beauty is stoping the current random implementation from
compiling. Obvious solution is to enable
BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS for VC7.
Any ideas?
Michael
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk