geometry icon indicating copy to clipboard operation
geometry copied to clipboard

1.82.0 MSVC Warning: C4244: boost\geometry\algorithms\detail\equals\collect_vectors.hpp(354,61)

Open wanghan02 opened this issue 2 years ago • 0 comments

With the example code of boost::geometry::equals, if we change the point type to tuple<long long, long long>, MSVC 2022 17.1 complains warning C4244 under /W4:

boost\geometry\algorithms\detail\equals\collect_vectors.hpp(354,61): warning C4244: 'argument': conversion from '__int64' to 'const T', possible loss of data
        with
        [
            T=calculation_type
        ]
#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>

BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)

#include <boost/assign.hpp>

int main()
{
	using boost::assign::tuple_list_of;

	typedef boost::tuple<long long, long long> point;

	boost::geometry::model::polygon<point> poly1, poly2;
	boost::geometry::exterior_ring(poly1) = tuple_list_of(0, 0)(0, 5)(5, 5)(5, 0)(0, 0);
	boost::geometry::exterior_ring(poly2) = tuple_list_of(5, 0)(0, 0)(0, 5)(5, 5)(5, 0);

	std::cout
		<< "polygons are spatially "
		<< (boost::geometry::equals(poly1, poly2) ? "equal" : "not equal")
		<< std::endl;

	boost::geometry::model::box<point> box;
	boost::geometry::assign_values(box, 0, 0, 5, 5);

	std::cout
		<< "polygon and box are spatially "
		<< (boost::geometry::equals(box, poly2) ? "equal" : "not equal")
		<< std::endl;


	return 0;
}

wanghan02 avatar Jul 03 '23 10:07 wanghan02