Date: 2000-01-29 16:20:10
Where do you see the need for typeof?
I've talked with Gary Powell about their implementation of this, and
he sent me a copy. It was good, but missing a couple things I wanted,
and a bit more complicated than necessary. He's working on a new
version which should be better. In the mean time I've also whipped up
a version based on the idea of using an extended version of Nico's
composition library as the nodes in the expression tree. Seems to be
much simpler this way than Gary's older version... it will be
interesting to compare it to his upcoming newer version. As to how
ugly/pretty it is... well, I did use a *lot* of macros to cut down on
the repetition, but that seemed to be a minor evil.
I've posted the experimental code to the docvault, under /functors.
The functors in this version are similar to the standard in being
templated on the argument and result types. A better approach is to
not template the functor classes, and instead template the
operator(). This allows the user to not bother with specifying the
types in the "arg" classes. However this approach requires member
templates and therefore less VC++ friendly. I've tried this
approach with EDG and g++ and it works very nicely.
Valentin Bonnard writes:
> jsiek_at_[hidden] wrote:
> > Basically, the idea is to overload all the typical operators
> > (+, -, <, ==) for functor objects, and use Nico's composition
> > library as the nodes in the expression tree. It's really not
> > all that hard to do...
> How it is possible at all w/o typeof, which no compiler (not even
> gcc) supports ?
> (and even then (w/ typeof) it would be ugly)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk