Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-06 18:26:07


"Andy Little" <andy_at_[hidden]> writes:

> "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."

Did my (mis)quoting differ in substance, or can we forget it?

>> 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);

Sure.

>> > 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...

Whatever that means. I'm not sure it's an art, and I'm not convinced
it's less-practiced than separation-of-concerns, which is what I'm
advocating. I see glomming ("Blob-ing", really) all over.

>> > 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.

It means registering user-defined types and templates that may
participate in the result type.

Arkadiy's typeof from the Boost Files area at yahoogroups:
http://tinyurl.com/32mlf

No docs, lots of examples.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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