Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-11-08 08:37:06


Jeet Sukumaran wrote:

> ...
>
>1. There will be an abstract base class (protocol class) that shall
>define the interface through which all random number requests by
client
>code are made. I've included a proposal of such a base class,
called
>"random_number" below.
>
>2. From this base class, various template classes shall be derived.

>Each template class is parameterized on "Generator," which can be
any
>type that fulfills certain minimum requirements:
>
> ...

Jeet,

Instead of an abstract base class, think of making random_number
either a template or simply a requirement like the standard clause 23
container requirements. My guess is that either of those approaches
will lead to more elegant, easier to use, solutions.

Combining them both may be the most elegant solution of all. In
other words, specify a RandomNumber requirement, and then supply a
random_number template which is one example of a family of classes
which meet the RandomNumer requirement.

Efficiency can also be very important for PRNG's, so PRNG's shouldn't
be forced to be polymorphic (that is, have virtual members).

Don't become discouraged by all the work it takes to design the
interface. The end product will be a much stronger library which
will stand the test of time.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk