Boost logo

Boost Users :

Subject: [Boost-users] problems using boost::polygon::get_rectangles
From: TomDrummond (tom.drummond_at_[hidden])
Date: 2015-03-27 12:41:26


Hello I'm trying to use the function get_rectangles to return a list of
rectangles however I can' get the code to compile.

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

    std::vector< boost::polygon::rectangle_data<int> > rects;
    typedef boost::polygon::polygon_90_with_holes_data<int> Polygon90;
    Polygon90 poly;
    typedef boost::polygon::polygon_traits<Polygon90>::point_type MyPoint;

    MyPoint pts[] = { boost::polygon::construct<MyPoint>(0, 0),
      boost::polygon::construct<MyPoint>(0, 10),
      boost::polygon::construct<MyPoint>(30, 10),
      boost::polygon::construct<MyPoint>(30, 20),
      boost::polygon::construct<MyPoint>(10, 20),
      boost::polygon::construct<MyPoint>(10, 0) };

    boost::polygon::set_points(poly, pts, pts + 6);

    boost::polygon::get_rectangles(rects, poly );

which gives the error

1>c:\lib\boost\1.57.0\boost\polygon\detail/rectangle_formation.hpp(261):
error C2784: 'boost::rational<IntType> boost::abs(const
boost::rational<IntType> &)' : could not deduce template argument for 'const
boost::rational<IntType> &' from 'int'
1> C:\lib\boost\1.57.0\boost/rational.hpp(104) : see declaration of
'boost::abs'
1> c:\lib\boost\1.57.0\boost\polygon\polygon_90_set_data.hpp(180) :
see reference to function template instantiation 'void
boost::polygon::form_rectangles<output_container,std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;std::pair&lt;int,std::pair&lt;int,int>>>>>,boost::polygon::rectangle_concept>(output_container
&,iterator_type,iterator_type,boost::polygon::orientation_2d,rectangle_concept)'
being compiled
1> with
1> [
1>
output_container=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> ,
iterator_type=std::_Vector_iterator<std::_Vector_val&lt;std::_Simple_types&lt;std::pair&lt;int,std::pair&lt;int,int>>>>>
1> , rectangle_concept=boost::polygon::rectangle_concept
1> ]
1> c:\lib\boost\1.57.0\boost\polygon\polygon_90_set_concept.hpp(86)
: see reference to function template instantiation 'void
boost::polygon::polygon_90_set_data<int>::get_rectangles<output_container_type>(output_container
&) const' being compiled
1> with
1> [
1>
output_container_type=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> ,
output_container=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> ]
1> c:\lib\boost\1.57.0\boost\polygon\polygon_90_set_concept.hpp(86)
: see reference to function template instantiation 'void
boost::polygon::polygon_90_set_data<int>::get_rectangles<output_container_type>(output_container
&) const' being compiled
1> with
1> [
1>
output_container_type=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> ,
output_container=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> ]
1> TerrainDispatcher.cpp(185) : see reference to function template
instantiation 'void
boost::polygon::get_rectangles<std::vector&lt;boost::polygon::rectangle_data&lt;int>,std::allocator<_Ty>>,Polygon90>(output_container_type
&,const polygon_set_type &)' being compiled
1> with
1> [
1> _Ty=boost::polygon::rectangle_data<int>
1> ,
output_container_type=std::vector<boost::polygon::rectangle_data&lt;int>,std::allocator<boost::polygon::rectangle_data&lt;int>>>
1> , polygon_set_type=Polygon90
1> ]

I'm quite new to both boost and templates so any help would be appreciated.

--
View this message in context: http://boost.2283326.n4.nabble.com/problems-using-boost-polygon-get-rectangles-tp4673863.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net