谁能指导我如何使用 view_as
。或者也许是 boost 多边形库中的示例?
在文档中,提到我们可以从一个类型转换为另一个类型。
http://www.boost.org/doc/libs/1_58_0/libs/polygon/doc/gtl_polygon_90_concept.htm
最佳答案
boost::polygon 文档不是很好,但至少在这方面它看起来相当清楚:
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 theview_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.
关于c++ - view_as 在 Boost Polygon 库中的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31182791/