Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-07-03 04:38:23


An example that I think demonstrates the superiority of this:

        binary_operation<A,Op,B>::result_type result;

over this:

    result_of_plus<A, B>::type result;

in this directory:

http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/source/

array_calcs.hpp and array_calcs.cpp. The example shows an expression
template for arrays based on the examples in:

http://osl.iu.edu/~tveldhui/papers/techniques/

(BTW this is part of my next distro so no guarantee it works in pqs-1-01-04
, though should be ok.)

Specifically making the operator a template parameter makes it generic IMHO
and much reduces the work required.
If an expression is required in "typeof" then it cant work generically ,
unless operators are allowed as template params And a generic
"placeholder"operator param is included. (Simple promotion is inadequate for
udts)

Simple useage of binary_operation described here:

http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/binary_operation.html

regards
Andy Little


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