|
Geometry : |
Subject: [ggl] Surprising ADL
From: feverzsj
Date: 2010-05-05 08:55:58
hi,
The following code won't compile on msvc8/9, and both of the
compliers give the same diagnostic output for "ambiguous call to
overloaded function" and "one of the overloads is found by ADL".
#include <boost/geometry/geometry.hpp>
namespace ns
{
template<typename T1, typename T2, typename T3>
bool transform(T1 const& a, T2& b, T3 const& c)
{
return boost::geometry::transform(a, b, c);
}
template<typename T1, typename T2>
bool transform(T1 const& a, T2& b)
{
return boost::geometry::transform(a, b);
}
}
int main()
{
using namespace ns;
typedef boost::geometry::point_xy<double> point2d;
point2d pt1, pt2;
transform(pt1, pt2);
// ns::transform(pt1, pt2); // with qualified call, everything is ok
}
I think that's mainly because of the unqualified call inside
boost::geometry::transform().
template <typename Geometry1, typename Geometry2>
inline bool transform(Geometry1 const& geometry1, Geometry2& geometry2)
{
concept::check<Geometry1 const>();
concept::check<Geometry2>();
typename detail::transform::select_strategy<Geometry1,
Geometry2>::type strategy;
return transform(geometry1, geometry2, strategy); // unqualified call.
}
Regards, ZhouShuangJiang
Geometry list run by mateusz at loskot.net