
Steven Watanabe wrote:
A virtual function can't be a template.
... exactly my problem ... :-)
You might be able to use something like this:
template<class ResultType> class runtime_generator { public: ResultType min() const { return min_; } ResultType max() const { return max_; } ResultType operator()() { return impl(); } private: ResultType min_, max_; boost::function
impl; };
I'm sorry, I'm not sure I understand your suggestion. :-( It's not clear to me how Boost's uniform random number generators (URNGs) are meant to be passed around. I'm used to working with the GNU Scientific Library where a URNG is simply a pointer that can be passed around easily, void foo(gsl_rng *r) { // generate some numbers with r ... } ... where of course the particular URNG algorithm may vary. By contrast it's not clear to me how, using Boost's random library, to write code which uses a URNG without specifying its exact type -- unless I use templates. Can you advise? Sorry for my lack of understanding of your suggestion. Thanks & best wishes, -- Joe