1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
7 // This file was modified by Oracle on 2015.
8 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
19 #ifndef BOOST_GEOMETRY_UTIL_TRANSFORM_VARIANT_HPP
20 #define BOOST_GEOMETRY_UTIL_TRANSFORM_VARIANT_HPP
23 #include <boost/mpl/transform.hpp>
24 #include <boost/variant/variant_fwd.hpp>
27 namespace boost { namespace geometry
32 \brief Meta-function that takes a Sequence type, an MPL lambda
33 expression and an optional Inserter and returns a variant type over
34 the same types as the initial variant type, each transformed using
35 the lambda expression.
39 typedef boost::mpl::vector<int, float, long> types;
40 typedef transform_variant<types, add_pointer<_> > transformed;
41 typedef variant<int*, float*, long*> result;
42 BOOST_MPL_ASSERT(( equal<result, transformed> ));
45 template <typename Sequence, typename Op, typename In = boost::mpl::na>
46 struct transform_variant:
48 typename boost::mpl::transform<
58 \brief Meta-function that takes a boost::variant type and an MPL lambda
59 expression and returns a variant type over the same types as the
60 initial variant type, each transformed using the lambda expression.
64 typedef variant<int, float, long> variant_type;
65 typedef transform_variant<variant_type, add_pointer<_> > transformed;
66 typedef variant<int*, float*, long*> result;
67 BOOST_MPL_ASSERT(( equal<result, transformed> ));
70 template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Op>
71 struct transform_variant<variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Op, boost::mpl::na> :
73 typename boost::mpl::transform<
74 typename variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types,
81 }} // namespace boost::geometry
84 #endif // BOOST_GEOMETRY_UTIL_TRANSFORM_VARIANT_HPP