]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/box_templated.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / register / box_templated.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//[register_box_templated
11//` Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/point_xy.hpp>
17#include <boost/geometry/geometries/register/box.hpp>
18
19template <typename P>
20struct my_box
21{
22 P ll, ur;
23};
24
25// Register the box type
26BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(my_box, ll, ur)
27
28int main()
29{
30 typedef my_box<boost::geometry::model::d2::point_xy<double> > box;
31 box b = boost::geometry::make<box>(0, 0, 2, 2);
32 std::cout << "Area: " << boost::geometry::area(b) << std::endl;
33 return 0;
34}
35
36//]
37
38
39//[register_box_templated_output
40/*`
41Output:
42[pre
43Area: 4
44]
45*/
46//]