Boost logo

Boost :

Subject: Re: [boost] [polygon] examplefile compilation failed
From: J Stark (boost_at_[hidden])
Date: 2014-07-08 15:04:47


Hello Boost Polygon Folk,

First off, I have to say, boost polygon is pretty great. Thanks for all the
hard work you've put into it.

I'm replying to a forum message here:
http://boost.2283326.n4.nabble.com/template/NamlServlet.jtp?macro=reply&node=2665964

which notes that the example files don't compile. It was posted in 2009.

I'm noticing that the example here:
http://www.boost.org/doc/libs/1_55_0/libs/polygon/doc/gtl_custom_polygon.htm
still doesn't compile properly on a mac using Apple LLVM version 5.0
(clang-500.2.79)

I think the examples are extremely important, as template programming can be
confusing all by itself, and so having a working example to start with is
really a time saver.

Does this example work properly with other compilers making it hard to fix
for the universal/general case?

It seems that the original post from 2009 contains the fix that works;
"typedef int coordinate_type;" needs to be inserted in point_mutable_traits
like so:

  template <>
  struct point_mutable_traits<CPoint> {
    typedef int coordinate_type;
    static inline void set(CPoint& point, orientation_2d orient, int value)
{
      if(orient == HORIZONTAL)
        point.x = value;
      else
        point.y = value;
    }
    static inline CPoint construct(int x_value, int y_value) {
      CPoint retval;
      retval.x = x_value;
      retval.y = y_value;
      return retval;
    }
  };
} }

My question is if the documentation example here:
http://www.boost.org/doc/libs/1_55_0/libs/polygon/doc/gtl_custom_polygon.htm

can be updated to include this fix, and save time for folks who are trying
to get that example to work, or if this solution isn't valid for some
combination of other more popular compilers?

Thanks again for all the hard work on the library, and very best of regards,

J

PS: please advise if I'm posting to the wrong forum, sending mail in the
wrong way, or in any way going at this the wrong way :) I have more
questions/concerns to follow up with :)

--
View this message in context: http://boost.2283326.n4.nabble.com/polygon-examplefile-compilation-failed-tp2665960p4664887.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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