]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/util/transform_variant.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
16 #include <boost/test/included/test_exec_monitor.hpp>
17 #include <boost/geometry/util/transform_variant.hpp>
18 #include <boost/mpl/assert.hpp>
19 #include <boost/mpl/equal.hpp>
20 #include <boost/mpl/placeholders.hpp>
21 #include <boost/mpl/vector.hpp>
22 #include <boost/type_traits.hpp>
23 #include <boost/variant/variant.hpp>
25 using boost::mpl::placeholders::_
;
28 template <typename ExpectedTypes
, BOOST_VARIANT_ENUM_PARAMS(typename T
)>
29 void check(boost::variant
<BOOST_VARIANT_ENUM_PARAMS(T
)>)
33 typename
boost::variant
<BOOST_VARIANT_ENUM_PARAMS(T
)>::types
,
40 int test_main(int, char* [])
42 // Transform Variant to Variant
43 typedef boost::geometry::transform_variant
<
44 boost::variant
<int, float, long>,
48 check
<boost::mpl::vector
<int*, float*, long*> >(transformed1());
50 // Transform Sequence to Variant (without inserter)
51 typedef boost::geometry::transform_variant
<
52 boost::mpl::vector
<int, float, long>,
56 check
<boost::mpl::vector
<int*, float*, long*> >(transformed2());
58 // Transform Sequence to Variant (with inserter)
59 typedef boost::geometry::transform_variant
<
60 boost::mpl::vector
<int, float, long>,
61 boost::add_pointer
<_
>,
62 boost::mpl::back_inserter
<boost::mpl::vector0
<> >
65 check
<boost::mpl::vector
<int*, float*, long*> >(transformed3());