
29 May
2006
29 May
'06
11:35 p.m.
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@alinoe.com>