Boost logo

Boost :

Subject: Re: [boost] [Polygon] What does this error mean?
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-09-01 16:56:53


Phil Endecott wrote:
> Dear Luke (& others),
>
> Here's some test code, followed by the errors that I get when I try to
> compile it. It boils down to some confusion about whether set is a
> type or a function. Am I doing something that isn't allowed? Thanks
> for any suggestions.
>
> template <>
> struct rectangle_traits<screen_box_t> {
> typedef screen_coord_t coordinate_type;
> typedef std::pair<screen_coord_t,screen_coord_t> interval_type;
> static inline interval_type get(const screen_box_t& rectangle,
> orientation_2d orient) {
> return (orient==HORIZONTAL) ?
> std::make_pair(rectangle.x0,rectangle.x1) :
> std::make_pair(rectangle.y0,rectangle.y1); } };
> }; };

Phil,

I boils down to the fact that you are using std::pair<int, int> for your interval return type in get() in the screen_box_t traits, but did not register it as a type of interval concept or define traits for it. If you set up the interval_traits for std::pair and register it with a specialization of geometry_concept for interval_concept you should be fine. It states in the docs that while pair or tuple can be made concepts of point or interval, I don't do that for you because I can't make them simultaneously point and interval. If you later set up point_traits for std::pair somewhere else you will get a raft of ambiguous overload errors because both point and interval interfaces will match your type.

Thanks,
Luke


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk