Boost logo

Geometry :

Subject: Re: [geometry] Breaking change on distance strategies
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-07-23 17:08:46


Hi Adam, Bruno,

>
> I've noticed slightly different behavior of distance_pythagoras. The
> result type in the previous version was double for integral
> corrdinates. Now CalculationType is also integral type (probably the
> same as coordinate_type) and this causes ambiguous call to sqrt() in
> line 158. I didn't dive into it but is default_distance_result also an
> integral type? Is it intentional?

The implementation was correct, the only thing is that MSVC does not
know how to do std::sqrt(int) or std::sqrt(__int64). It considers it as
ambiguous.

I fixed it by casting it. The previous version did it in two steps,
therefore it was automatically casted. In the change this two steps were
merged, why the problem occurred. But the types are OK. The comparable
strategy calculates in integers (= OK) and the strategy itself returns a
double (= OK) (all by default)

Regards, Barend


Geometry list run by mateusz at loskot.net