]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/concepts/point_without_dimension.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / concepts / point_without_dimension.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14
15
16 #include "function_requiring_a_point.hpp"
17
18 #include <boost/geometry/core/cs.hpp>
19
20 struct point
21 {
22 point() : x(0), y(0) {} // initialize to suppress warnings
23 float x, y;
24 };
25
26
27 namespace boost { namespace geometry { namespace traits {
28
29 template <> struct tag<point> { typedef point_tag type; };
30 template <> struct coordinate_type<point> { typedef float type; };
31 template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
32 //template <> struct dimension<point> { enum { value = 2 }; };
33
34 template <> struct access<point, 0>
35 {
36 static float get(point const& p) { return p.x; }
37 static void set(point& p, float value) { p.x = value; }
38 };
39
40 template <> struct access<point, 1>
41 {
42 static float get(point const& p) { return p.y; }
43 static void set(point& p, float value) { p.y = value; }
44 };
45
46
47 }}} // namespace bg::traits
48
49
50 int main()
51 {
52 point p1;
53 const point p2;
54 test::function_requiring_a_point(p1, p2);
55 return 0;
56 }