
On Tue, Apr 27, 2010 at 1:50 PM, Joseph Gauterin
Looks like you need some sort of type erasure (Steve's suggestion uses boost::function for that):
* Create a class that can be passed to uniform_real as a generator - that is what Steve's runtime_generator class is for. * Give runtime_generator a constructor that takes a single argument of a template type, initialize min_ and max_ from that and store the argument in impl (that will compile if the argument is a rng that follows the correct conventions) * Write the virtual function you wanted taking an argument of type runtime_generator<double>& - but make it private
Why should the virtual function be private? I suppose the reason to use a virtual function is: * to make it overridable in a derived class * to call it via runtime polymorphism. Making it private don't see how it could work Thank you very much Cheers, -- Marco