1.82.0 MSVC Warning: C4244: boost\geometry\algorithms\detail\equals\collect_vectors.hpp(354,61)
- Dominant language
- C++
- Stars
- 517
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
With the example code of [boost::geometry::equals](https://live.boost.org/doc/libs/1_82_0/libs/geometry/doc/html/geometry/reference/algorithms/equals/equals_2.html), if we change the point type to tuple, 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
#include
#include
#include
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
#include
int main()
{
using boost::assign::tuple_list_of;
typedef boost::tuple point;
boost::geometry::model::polygon 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 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;
}
```
Contributor guide
Research direction
The warning points to boost/geometry/algorithms/detail/equals/collect_vectors.hpp at line 354; begin by inspecting the conversion there and how the reported example's long long point type reaches it. Reproduce with MSVC 2022 under /W4 using the supplied polygon-and-box example. Done means the example builds without C4244 while equality results remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100