boostorg / polygon

Boost.org polygon module
http://boost.org/libs/polygon
57 stars 70 forks source link

Crash with VS 16.8.6 but working with clang 11/13 and gcc 11 #63

Open nicolasLA opened 3 years ago

nicolasLA commented 3 years ago

Hi there,

We encountered a weird error running the following code using boost::polygon.

It is compiling and working on:

and compiling but crashing with cl from Visual Studio 16.8.6.

Do you have any idea about what is going on please?

Cheers, Nicolas

#include <vector>
#include <boost/polygon/polygon.hpp>

int main()
{
    using Polygon = boost::polygon::polygon_data<int>;
    using PolygonPoints = std::vector<typename Polygon::point_type>;
    PolygonPoints polygonPoints{
        { 0, 0 },
        { -37570000, 37568665 },
        { -233490372, -195921616 },
    };
    Polygon const polygon{ std::begin(polygonPoints), std::end(polygonPoints) };

    boost::polygon::polygon_set_data<int> polygonSet;
    polygonSet.insert(polygon);

    std::vector<Polygon> trapezoids;
    polygonSet.get_trapezoids(trapezoids);

    std::cout << "#trapezoids: " << trapezoids.size() << std::endl;

    auto index{ 0 };

    for (auto const& trapezoid: trapezoids)
    {
        std::cout << "trapezoid " << index << ":" << std::endl;
        auto pointIndex{ 0 };

        for (auto const& coord: trapezoid.coords_)
        {
            std::cout << "point " << pointIndex << ": " << coord.x() << "; " << coord.y() << std::endl;
            ++pointIndex;
        }

        ++index;
    }
}
nicolasLA commented 3 years ago

Bump. Still the case with VS 16.11.3

nicolasLA commented 2 years ago

Bump. Still the case with VS 16.11.11