2

Can anyone guide me how view_as can be used. Or maybe an example in boost polygon library?

In documentation, it's mentioned that we can type cast from one to another.

http://www.boost.org/doc/libs/1_58_0/libs/polygon/doc/gtl_polygon_90_concept.htm

alfC
  • 14,261
  • 4
  • 67
  • 118
user765443
  • 1,856
  • 7
  • 31
  • 56
  • If the docs mention that, perhaps you can link to it so we know what you mean. It's not clear to me – sehe Jul 02 '15 at 13:38

1 Answers1

1

The boost::polygon documentation is not great, but in this area at least it does seem to be fairly clear:

An object that is a model of polygon_90_concept can be viewed as a model of any of its refinements if it is determined at runtime to conform to the restriction of those concepts. This concept casting is accomplished through the view_as<>() function.

view_as<rectangle_concept>(polygon_90_object)

The return value of view_as<>() can be passed into any interface that expects an object of the conceptual type specified in its template parameter.

Paul R
  • 208,748
  • 37
  • 389
  • 560