From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-06-19 21:38:33
On Thu, Jun 19, 2008 at 08:12, Kasra (Math & ComSci)
> However, I looked at random number generators on [boost][random] but they don't seem to implement a base class! Am I right or I have mised something?
Probably not. The "Boost Way" is to have them all have the same
interface, so that templates can use them, but not to use a base
class, since virtual is expensive (to call in those reference
parameters), limiting (in that they all have to use the same data
types), and adds space overhead (for the vtable).
And you can always wrap up a template into a virtual interface if you
need it, and it'll be just as efficient as if it were originally
virtual. The other way doesn't work.
Just template on the RNG and all is good.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk