开发者

Crashes when using boost::random

I got a relatively serious problem with boost::random. Background: I'm using TDM-GCC x64 on Windows 7 x64. Compiler options are -g -Wall -fexceptions I build Boost using the same compiler enviroment, but that shouldn't matter when using random since it is header-only(?)

So now my problem: I got this function:

#define PRNG_GENERATOR boost::mt19937

COORD function_g(int depth)
    {
        double _range;
        _range = 1/(depth + 1.0f);

        boost::uniform_real<double> range(-_range, _range);

        boost::variate_generator<PRNG_GENERATOR&, boost::uniform_real<double> > v_png(*this->m_prng, range);

        return v_png();
    }

When I call this function my program crashes with an c0000026 Error in the ntdll.dll module. The crash is always displayed by gdb on the first line of the ()-operator of the random number engine of boost (in this case it is in the file mersenne_twiseter.hpp at line 319 which is "if(i == n)" - not actually something I would expect to cause a crash). And the even more strange thing is, that this crash just appeared - I didn't commited any code changes, just a (clean) recompi开发者_StackOverflow社区le and every build after the first showing the crash just crashes....!?

I spend now about one hour searching the internet for this mysterious c0000026 error, but didn't found anything valueable....

Someone got a tip how to resolve this issue?


You haven't shown us how this->m_prng is initialized. Are you sure it points to a valid object of type boost::mt19937? The rest of it looks OK, as far as I can tell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜