Boost logo

Boost :

From: Csaba Szepesvari (cszepes_at_[hidden])
Date: 2003-05-19 11:10:38


trying to compile the minimal sample code below I get:

 'std::numeric_limits<`template-parameter258'>::is_integer' : illegal use of
this type as an expression
        c:\dev\include\boost\random\uniform_01.hpp(95) : see reference to
class template instantiation
'boost::uniform_01<UniformRandomNumberGenerator,RealType>' being compiled

The problem is that although random.hpp includes limits.hpp from boost and
limits.hpp
includes boost/detail/limits.hpp only if BOOST_NO_LIMITS is defined.
Wouldn't it be good to add BOOST_NO_LIMITS to either
- config
- the random library

I understand that the user should (maybe) decide about using
BOOST_NO_LIMITS, however,
the user also wants random.hpp compiling "out-of-box".
Maybe, should add BOOST_NO_LIMITS_ASWORKAROUND
and limits.hpp should also check this and if defined include
boost/detail/limits.hpp.
Well, this could cause other problems if the user inadvertantly(:)) includes
<limits> in the same compilation unit.
But then at least the user would face the real problem and could decide what
to do.
(Maybe some documentation of this would also be useful e.g. documenting what
libs workarounds that incluences the files the user can include.

- Csaba

------------- SAMPLE CODE ---------------------------
//#define BOOST_NO_LIMITS

#include <boost/config.hpp>
#include <boost/random.hpp>
#include <iostream>
int main()
{
  using namespace boost;

  minstd_rand mm;
  int x = mm();
  std::cout << x;
  return 0;
}


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