Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2006-05-29 19:35:38


On Mon, May 29, 2006 at 10:35:16PM +0100, Bronek Kozicki wrote:
> modulus could be template parameter. In this case
> 1 - there is no static state (which complicates things a lot in multithreaded
> programs)
> 2 - number with different modulus are in fact distinct types
> 3 - if there is any kind of operation that can be performed between such
> distinct types, it can be safely defined in the interface, together with
> appropriate compile-time checking
4 - it is possible to optimize algorithms as function of the modulus,
    by using a different algorithm (by means of specialization).

Because it makes no sense to switch between different moduli,
I can't think of a reason to NOT make it a template parameter.

-- 
Carlo Wood <carlo_at_[hidden]>

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