Polygon_2::bbox won't compile

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Polygon_2::bbox won't compile

Roger House
I encountered a problem with Polygon_2::bbox which I believe I have fixed, but I would like confirmation.  Unfortunately, I have not been able to devise a small program which demonstrates the problem, and I am unable to send the larger program in which the problem arose.  However, the context was this:

    static bool some_func(const CGAL_Polygon &poly)
    {
        CGAL_Bbox bbox = poly.bbox();
        ...
    }

The call of poly.bbox resulted in the error message at the end of this email, in which line 234 of Polygon_2.h is mentioned.  The return statement in the following function is line 234 of Polygon_2.h:

    Bbox_2 bbox() const
    {
      return bbox_2(d_container.begin(), d_container.end());
    }

After looking at some of the nearby code in Polygon_2.h, I made a wild guess and added a third parameter:

      return bbox_2(d_container.begin(), d_container.end(), traits);

This not only compiled, but it seems to be working.

Please let me if this fix is okay.

Thank you,

Roger House
 
/usr/include/CGAL/Polygon_2.h: In member function ‘CGAL::Bbox_2 CGAL::Polygon_2<Traits_, Container_>::bbox() const [with Traits_P = CGAL::Cartesian<double>, Container_P = std::vector<CGAL::Point_2<CGAL::Cartesian<double> >, std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > >]’:
connhole.cpp:320:   instantiated from here
/usr/include/CGAL/Polygon_2.h:234: error: no matching function for call to ‘bbox_2(__gnu_cxx::__normal_iterator<const CGAL::Point_2<CGAL::Cartesian<double> >*, std::vector<CGAL::Point_2<CGAL::Cartesian<double> >, std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > > >, __gnu_cxx::__normal_iterator<const CGAL::Point_2<CGAL::Cartesian<double> >*, std::vector<CGAL::Point_2<CGAL::Cartesian<double> >, std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > > >)’
Reply | Threaded
Open this post in threaded view
|

Re: Polygon_2::bbox won't compile

Sylvain Pion
Administrator
Roger House wrote:

> I encountered a problem with Polygon_2::bbox which I believe I have
> fixed, but I would like confirmation.  Unfortunately, I have not been
> able to devise a small program which demonstrates the problem, and I am
> unable to send the larger program in which the problem arose.  However,
> the context was this:
>
>     static bool some_func(const CGAL_Polygon &poly)
>     {
>         CGAL_Bbox bbox = poly.bbox();
>         ...
>     }
>
> The call of poly.bbox resulted in the error message at the end of this
> email, in which line 234 of Polygon_2.h is mentioned.  The return
> statement in the following function is line 234 of Polygon_2.h:
>
>     Bbox_2 bbox() const
>     {
>       return bbox_2(d_container.begin(), d_container.end());
>     }
>
> After looking at some of the nearby code in Polygon_2.h, I made a wild
> guess and added a third parameter:
>
>       return bbox_2(d_container.begin(), d_container.end(), traits);
>
> This not only compiled, but it seems to be working.
>
> Please let me if this fix is okay.
Well, no, the code is supposed to be correct.

I can't think of a reason why you see what you see.
Please provide more context if possible.


> Thank you,
>
> Roger House
>  
> /usr/include/CGAL/Polygon_2.h: In member function ‘CGAL::Bbox_2
> CGAL::Polygon_2<Traits_, Container_>::bbox() const [with Traits_P =
> CGAL::Cartesian<double>, Container_P =
> std::vector<CGAL::Point_2<CGAL::Cartesian<double> >,
> std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > >]’:
> connhole.cpp:320:   instantiated from here
> /usr/include/CGAL/Polygon_2.h:234: error: no matching function for call
> to ‘bbox_2(__gnu_cxx::__normal_iterator<const
> CGAL::Point_2<CGAL::Cartesian<double> >*,
> std::vector<CGAL::Point_2<CGAL::Cartesian<double> >,
> std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > > >,
> __gnu_cxx::__normal_iterator<const CGAL::Point_2<CGAL::Cartesian<double>
>  >*, std::vector<CGAL::Point_2<CGAL::Cartesian<double> >,
> std::allocator<CGAL::Point_2<CGAL::Cartesian<double> > > > >)’

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/


smime.p7s (5K) Download Attachment