Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-07-06 17:23:10


"David Abrahams" <dave_at_[hidden]> wrote in message
news:uk6xhf6kh.fsf_at_boost-consulting.com...
> "Andy Little" <andy_at_[hidden]> writes:
>
> > "David Abrahams" <dave_at_[hidden]> wrote
> >> "Andy Little" <andy_at_[hidden]> writes:
> >> > "David Abrahams" <dave_at_[hidden]> wrote

> You say you're talking about "operations not types", but I think

hmmm.. Actual quote is " I am talking about operations rather than
types after all."

> you're just mystifying something that's simple. Whether or not
> multiplication is commutative depends entirely on the types of its
> operands.

Whether or not a binary operation is commutative depends on the operator and
the types and values of its operands.

int x=10,y=x; assert(y/x == x/y);assert(y-x == x-y);

> > I found output of (say) operator + as "+" useful in following the
> > execution of expression templates. "super-functional" is an
> > off-the-cuff replacement for <functional>. Dont take it too
> > seriously, but std::plus etc are past their best. If I wish to know
> > whether an operation on two types is commutative, I might like to be
> > able to quiz the operation about it. decltype wont do that for me.
>
> And neither should that trait be glommed into the one used for
> determining result types.

Keep talking... youre winning me over...
Though I shall mourn glomming.. for it is a less practised art...

[snip]

> > I need some way to get information about the result types of my
> > value_types operation. eg What results form mux of a
> > interval<double> and a double.
> >
> > result_of is ok as far as it goes. but
> > 1) There needs to be a common name for Op ie operator_XX or
> > whatever.
>
> Sure.

I suggest operator_plus etc ( cos it's close to operator+)... maybe there
are other candidates...?

> > Otherwise we will all be carrying on our merry own way. That is the
status
> > quo.
> >
> > 2) In theory result_of is specializable for functors.
>
> It's a fact.
>
> > It would be
> > useful to test to find out how well this works in practise. Results
> > on gcc3.2 have not been encouraging.
>
> Maybe a compiler bug?

 ...but maybe not in gcc.

> > 3) typeof, decltype etc is not standard C++ as it stands. Its a
> > non-starter.
>
> Not neccessarily. We can build a pretty nice typeof replacement that
> requires just a little help from users.

Any documentation of this you can point me to ....?
I hope "a little help from users " means what it says.

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