Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

boost mersenne_twister and sun studio 11 c++ compiler

807575Jan 25 2006 — edited Jan 26 2006
Greetings,

What's wrong with the following (sniped from boost/random/mersenne_twister.hpp)
template<class UIntType, int w, int n, int m, int r, UIntType a, int u,
  int s, UIntType b, int t, UIntType c, int l, UIntType val>
void mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::twist(int block)
{
  const UIntType upper_mask = (~0u) << r;
  const UIntType lower_mask = ~upper_mask;

  if(block == 0) {
    for(int j = n; j < 2*n; j++) {
      UIntType y = (x[j-n] & upper_mask) | (x[j-(n-1)] & lower_mask);
      x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0);
    }
  } else if (block == 1) {
    // split loop to avoid costly modulo operations
    {  // extra scope for MSVC brokenness w.r.t. for scope
      for(int j = 0; j < n-m; j++) {
        UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask);
        x[j] = x[j+n+m] ^ (y >> 1) ^ (y&1 ? a : 0);
      }
    }

    for(int j = n-m; j < n-1; j++) {
      UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask);
      x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0);
    }
    // last iteration
    UIntType y = (x[2*n-1] & upper_mask) | (x[0] & lower_mask);
    x[n-1] = x[m-1] ^ (y >> 1) ^ (y&1 ? a : 0);
    i = 0;
  }
}
If I ifdef it out my test code compiles fine, if not I get the followin error:
"/home/bdeegan/dev/solaris/ext/boost/boost/include/boost/random/mersenne_twister.hpp", line 240: Error: twist(int) is not a member of boost::random::mersenne_twister<boost::random::UIntType, boost::random::w, boost::random::n, boost::random::m, boost::random::r, boost::random::a, boost::random::u, boost::random::s, boost::random::b, boost::random::t, boost::random::c, boost::random::l, boost::random::val>.

When just above the definition, I see the declaration:
private:
  void twist(int block);
Any ideas how to get this to compile in sun studio 11 c++ compiler?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2006
Added on Jan 25 2006
1 comment
106 views