Boost Users :
Subject: Re: [Boost-users] [random]how to initialise a rng for use in the initialiser list?
From: Yaser Zhian (yaserzt_at_[hidden])
Date: 2008-11-22 04:38:30
Moritz Beber wrote:
> I use a class which keeps the random number generator around as a member
> variable; this class also has a const matrix. Now in the constructor of
> the class I do something like:
> my_class::my_class(args) : rng(seed), matrix(initialise()), ...
> Of course, I want to use the rng to initialise the matrix and that's
> where things fail. I guess, I could use a different rng just to fill the
> matrix, or make it non-const and fill it in the constructor body. But
> does anyone know a neat trick to do this in the way proposed?
This might not be the best way, but you need to at least ensure that the
rng member of the class is declared before the matrix (in the class
Sorry if this doesn't, in fact, answer you problem.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net