Boost logo

Boost :

Subject: Re: [boost] RE [Boost-announce] [Review] Boost.Type Traits Extension by Frederic Bron
From: vijayan (vijayan121_at_[hidden])
Date: 2011-03-15 05:38:14


> Why? is it to avoid confusion with "equal to"?
> I like plus_equal because plus is a sign and equal is also a sign too. So
> I think it is easier to remember.

I also tend to vocalize += as 'plus equal'.
I suggested plus_assign because of the assign member function
provided by standard containers.

> This is not related to the return type. Only to the arguments of the operator.

Oh, I see.

> I think it is best to have the default behavior to forget about the
> return type. Why would you impose return type to be LHS?
> It is fine for +, -, ... when RHS=LHS but when you start to deal with
> different types, I think it just adds confusion.

I see your point.
And there is also an issue with derived class to base class conversion,
where the base class may have overloaded an operator.

> has_operator_plus<double, int> would then check for a return type
> "double" while has_operator_plus<int, double> for a return type int.
> You would break the symmetry of these operators.
> Also what about dereference operator?

Yes, it has been a perennial issue. Like in std::max<int,double>.
Unfortunately there doesn't seem to be a universally satisfying solution.
Fortunately, it is not a first order issue; one can always refuse to use
the default for the result type.

Thanks and regards

Vijayan


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