AMDG Dave Steenburgh wrote:
Or better, a minimal example to try?
I'd like to think I know what the problem is now, but I'm still a little mystified, and I'm not sure how best to correct it. What I think I want is a correction to or replacement for my wrapper class, but I definitely want a second opinion. (Maybe a third and a fourth, too...)
I've got a minimal-ish program that exhibits strange behavior, but it doesn't get stuck. I suspect the same phenomenon is at work here, though, since it still only appears when compiling without optimization. The source is attached, and here are some of my observations: If I use ng instead of vg, there is no problem. (Try it yourself; just move the comment slashes.) If I omit the call to problemFunction, everything works. If I decrease the number of arguments problemFunction requires, everything works. Based on that info, my guess is that something the random generator needs is created on the stack, and later overwritten. However, I think if that were really the problem, it would still be a problem on another platform, or with optimizations enabled.
The error is in this class:
class normalGenerator : public randomGenerator
{
private:
typedef boost::normal_distribution<> normalDistribution;
boost::variate_generator