
Hi David, David Greene wrote:
Because that's what the C++ standard says (AFAIR).
But the standard isn't always the best answer for all promotion situations. For example, some years back I wrote some expression template code for simulation purposes. I wanted a simple user interface so I promoted int / int to double to avoid loss of precision.
Right. So VIGRA supports two promotions standard Promote (what the compiler does by default) and RealPromote (the floating point promotion is guaruanteed)
Stuffed away in some cobweb-infested dusty disk sector I have a library that implements promotion "strategies" using a table-driven configuration of (operator/operand type -> promotion type) rules.
That's how VIGRA's promotion traits essentially work.
I'll see if I can dig it out and post it as a starting point. I'm not sure if it's what we want as a Boost library but it might be a start for discussion.
Will be interesting to look at. Regards Ulli -- ________________________________________________________________ | | | Ullrich Koethe Universitaet Hamburg / University of Hamburg | | FB Informatik / Dept. of Informatics | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe@computer.org Germany | | koethe@informatik.uni-hamburg.de | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|