[Generator Iterator] [random]

I am trying to use boost::generator_iterator with a random number generator as follows: --- #include <boost/generator_iterator.hpp> #include <boost/random/mersenne_twister.hpp> class my_generator {...}; my_generator gen; boost::generator_iterator<my_generator> first(&gen); boost::generator_iterator<my_generator> last; boost::random::mt19937 rng; rng.seed(first, last); --- Sadly the default constructor of generator_iterator leaves m_gen uninitialized and the seed function is trying to compare first with last. I could pass gen to last, ie. boost::generator_iterator<my_generator> last(&gen), but then if ever begin has the same value as end, it will stop. The documentation for generator_iterator says that it models an input iterator, and I assume that an input iterator is ok to use with the seed function. I'm not sure what can/should be done. Thanks in advance, Andy.

Hi Andy, I fear that this error message does not be picked up due to the sheer amout of traffic. Probably the best is adding a trac error message. Johannnes
participants (2)
-
Andy Tompkins
-
Johannes Brunen