Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2007-06-22 00:22:32


on Thu Jun 21 2007, "Scott, Steven" <Steven.Scott-AT-capitalone.com> wrote:

> w = v/x; // works fine
> w = x/v; // fails…
>
> I think the failure happens because of the way operator/
> defined for mixed types something like this:
>
> T operator/(U u,T t)
> {
> T ans(u);
> ans/=t;
> return ans;
> }
>
> which is not what I need. Is there a way I can change the way
> operator/(double,Vector) works in this one case, but keep the really convenient
> definitions generated by field_operators otherwise?

Are you sure you want that? I don't think it's meaningful to divide a
scalar by a vector. What would the result be?

Anyway, if you really do want that, the easy thing to do is add the
definition of the overload you want to your class in the usual manual
way.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net