]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/core/ring_type.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / core / ring_type.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// QuickBook Example
3
4// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10//[ring_type
11//`Shows how to use the ring_type metafunction, as well as interior_type
12
13#include <iostream>
14#include <typeinfo>
15
16#include <boost/geometry.hpp>
17#include <boost/geometry/geometries/polygon.hpp>
18#include <boost/geometry/geometries/point_xy.hpp>
19
20int main()
21{
22 typedef boost::geometry::model::d2::point_xy<double> point;
23 typedef boost::geometry::model::polygon<point> polygon;
24
25 typedef boost::geometry::ring_type<polygon>::type ring_type;
26 typedef boost::geometry::interior_type<polygon>::type int_type;
27
28 std::cout << typeid(ring_type).name() << std::endl;
29 std::cout << typeid(int_type).name() << std::endl;
30
31 // So int_type defines a collection of rings,
32 // which is a Boost.Range compatible range
33 // The type of an element of the collection is the very same ring type again.
34 // We show that.
35 typedef boost::range_value<int_type>::type int_ring_type;
36
37 std::cout
38 << std::boolalpha
39 << boost::is_same<ring_type, int_ring_type>::value
40 << std::endl;
41
42 return 0;
43}
44
45//]
46
47//[ring_type_output
48/*`
49Output (using gcc):
50[pre
51 N5boost8geometry5model4ringINS1_2d28point_xyIdNS0_2cs9cartesianEEELb1ELb1ESt6vectorSaEE
52St6vectorIN5boost8geometry5model4ringINS2_2d28point_xyIdNS1_2cs9cartesianEEELb1ELb1ES_SaEESaIS9_EE
53true
54]
55*/
56//]