Boost logo

Boost :

From: Synge Todo (wistaria_at_[hidden])
Date: 2002-12-12 00:09:42


Dear Boosters,

I have encountered problems when I tried to use current Boost Random
Number Library on SGI machine with MPIPpro Compiler 7.3.1.3m. One
error message is

cc-1522 CC: ERROR File = src/boost/boost/random/uniform_smallint.hpp, Line = 179
  The symbol template parameter
          "boost::detail::uniform_smallint<(bool)std::numeric_limits<URNG1::res
          ult_type>::is_integer>::impl" cannot have a template argument list.

    typedef typename detail::uniform_smallint<std::numeric_limits<typename UniformRandomNumberGenerator::result_type>::is_integer>::impl<UniformRandomNumberGenerator, IntType>::type impl_type;

This seems due to the lack of BOOST_NESTED_TEMPLATE macro in front of
impl. The header random/uniform_int.hpp also has this problem. Here
is a patch for fixing this problem:

--------------------------------------------------------------------------
diff -crN boost.orig/boost/random/uniform_int.hpp boost/boost/random/uniform_int.hpp
*** boost.orig/boost/random/uniform_int.hpp Tue Nov 5 07:07:23 2002
--- boost/boost/random/uniform_int.hpp Thu Dec 12 12:18:24 2002
***************
*** 205,211 ****
  {
  private:
  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
! typedef typename detail::uniform_int<std::numeric_limits<typename UniformRandomNumberGenerator::result_type>::is_integer>::impl<UniformRandomNumberGenerator, IntType>::type impl_type;
  #else
    BOOST_STATIC_CONSTANT(bool, base_float = (boost::is_float<typename UniformRandomNumberGenerator::result_type>::value == false));
    typedef typename detail::uniform_int<base_float>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
--- 205,211 ----
  {
  private:
  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
! typedef typename detail::uniform_int<std::numeric_limits<typename UniformRandomNumberGenerator::result_type>::is_integer>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
  #else
    BOOST_STATIC_CONSTANT(bool, base_float = (boost::is_float<typename UniformRandomNumberGenerator::result_type>::value == false));
    typedef typename detail::uniform_int<base_float>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
diff -crN boost.orig/boost/random/uniform_smallint.hpp boost/boost/random/uniform_smallint.hpp
*** boost.orig/boost/random/uniform_smallint.hpp Tue Nov 5 07:07:23 2002
--- boost/boost/random/uniform_smallint.hpp Thu Dec 12 12:18:53 2002
***************
*** 176,182 ****
  {
  private:
  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
! typedef typename detail::uniform_smallint<std::numeric_limits<typename UniformRandomNumberGenerator::result_type>::is_integer>::impl<UniformRandomNumberGenerator, IntType>::type impl_type;
  #else
    BOOST_STATIC_CONSTANT(bool, base_float = (boost::is_float<typename UniformRandomNumberGenerator::result_type>::value == false));
    typedef typename detail::uniform_smallint<base_float>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
--- 176,182 ----
  {
  private:
  #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
! typedef typename detail::uniform_smallint<std::numeric_limits<typename UniformRandomNumberGenerator::result_type>::is_integer>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
  #else
    BOOST_STATIC_CONSTANT(bool, base_float = (boost::is_float<typename UniformRandomNumberGenerator::result_type>::value == false));
    typedef typename detail::uniform_smallint<base_float>::BOOST_NESTED_TEMPLATE impl<UniformRandomNumberGenerator, IntType>::type impl_type;
--------------------------------------------------------------------------

Another problem is concerening boost_static_assert, e.g.

cc-3354 CC: ERROR File = src/boost.orig/boost/random/linear_feedback_shift.hpp, Line = 57
  A non-integral operation is not allowed in a nontype template argument.

    BOOST_STATIC_ASSERT(!std::numeric_limits<UIntType>::is_signed);
    ^

cc-1070 CC: ERROR File = src/boost.orig/boost/random/linear_feedback_shift.hpp, Line = 57
  The indicated type is incomplete.

    BOOST_STATIC_ASSERT(!std::numeric_limits<UIntType>::is_signed);
    ^

This problem looks the same as that in VC7. However, I found the
workaround for VC7 recently added to boost_static_assert.hpp does not
solve this problem for SGI MIPSpro. A possible workaround is as
follows:

--------------------------------------------------------------------------
diff -crN boost.orig/boost/static_assert.hpp boost/boost/static_assert.hpp
*** boost.orig/boost/static_assert.hpp Mon Sep 16 10:19:05 2002
--- boost/boost/static_assert.hpp Thu Dec 12 13:37:42 2002
***************
*** 72,77 ****
--- 72,86 ----
  # define BOOST_STATIC_ASSERT( B ) \
      typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
          [ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ]
+ #elif defined(__sgi)
+ // workaround for SGI MIPSpro compiler
+ #define BOOST_STATIC_ASSERT( B ) \
+ BOOST_STATIC_CONSTANT(bool, \
+ BOOST_JOIN(boost_static_assert_test_, __LINE__) = ( B )); \
+ typedef ::boost::static_assert_test<\
+ sizeof(::boost::STATIC_ASSERTION_FAILURE< \
+ BOOST_JOIN(boost_static_assert_test_, __LINE__) >)>\
+ BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
  #else
  // generic version
  #define BOOST_STATIC_ASSERT( B ) \
--------------------------------------------------------------------------

Best regards,

Synge Todo
wistaria_at_[hidden]


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