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 declaration.) Sorry if this doesn't, in fact, answer you problem. -yzt