Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-01-02 18:42:31


David A. Greene wrote:
> Aleksey Gurtovoy wrote:
> > Figuring out a reasonable way to specify the promotion
> > rules is probably the hardest part there...
>
> I actually did some work on this in the past but it's been sitting
> on the shelf for a while and probably needs a bit of pounding into
> shape. The design idea was to specify a template that acts as a
> lookup table keyed on the two source types and returning the correct
> result type according to a two other parameters: the operation
> and a parameter I'll call the "ruleset." The ruleset can be used to
> provide different promotion strategies such as ANSI/ISO C++ arithmetic
> rules, "keep the most information" rules and so on.
>
> A good example of ruleset use is the use of the "most information"
> rule to implement integer divide using double types to retain
> precision.
>
> Does this sound at all interesting?

Very!

> The implementation is complex (didn't have MPL at the time) but can
> probably be cleaned up some. It may be too flexible for your needs.

Even if so, it would give us some interesting prior art to start with
(besides the Blitz++'s one).

Aleksey


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