Boost logo

Boost :

From: Geoffrey Irving (irving_at_[hidden])
Date: 2006-05-29 20:04:46

On Tue, May 30, 2006 at 01:35:38AM +0200, Carlo Wood wrote:
> 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.

For an extremely common example of switching between different moduli,
look at this:

For example, RSA uses m_1 = p, m_2 = q prime, where M = pq is the public key.


Boost list run by bdawes at, gregod at, cpdaniel at, john at