annotate DEPENDENCIES/generic/include/boost/geometry/util/combine_if.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@102 2
Chris@102 3 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
Chris@102 4
Chris@102 5 // This file was modified by Oracle on 2015.
Chris@102 6 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
Chris@102 7
Chris@102 8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Chris@102 9
Chris@102 10 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@102 11 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@102 12
Chris@102 13 // Use, modification and distribution is subject to the Boost Software License,
Chris@102 14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@102 15 // http://www.boost.org/LICENSE_1_0.txt)
Chris@102 16
Chris@102 17 #ifndef BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
Chris@102 18 #define BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
Chris@102 19
Chris@102 20 #include <boost/mpl/fold.hpp>
Chris@102 21 #include <boost/mpl/if.hpp>
Chris@102 22 #include <boost/mpl/bind.hpp>
Chris@102 23 #include <boost/mpl/set.hpp>
Chris@102 24 #include <boost/mpl/insert.hpp>
Chris@102 25 #include <boost/mpl/placeholders.hpp>
Chris@102 26
Chris@102 27 #include <boost/type_traits.hpp>
Chris@102 28
Chris@102 29
Chris@102 30 namespace boost { namespace geometry
Chris@102 31 {
Chris@102 32
Chris@102 33 namespace util
Chris@102 34 {
Chris@102 35
Chris@102 36
Chris@102 37 /*!
Chris@102 38 \brief Meta-function to generate all the combination of pairs of types
Chris@102 39 from a given sequence Sequence except those that does not satisfy the
Chris@102 40 predicate Pred
Chris@102 41 \ingroup utility
Chris@102 42 \par Example
Chris@102 43 \code
Chris@102 44 typedef boost::mpl::vector<boost::mpl::int_<0>, boost::mpl::int_<1> > types;
Chris@102 45 typedef combine_if<types, types, always<true_> >::type combinations;
Chris@102 46 typedef boost::mpl::vector<
Chris@102 47 pair<boost::mpl::int_<1>, boost::mpl::int_<1> >,
Chris@102 48 pair<boost::mpl::int_<1>, boost::mpl::int_<0> >,
Chris@102 49 pair<boost::mpl::int_<0>, boost::mpl::int_<1> >,
Chris@102 50 pair<boost::mpl::int_<0>, boost::mpl::int_<0> >
Chris@102 51 > result_types;
Chris@102 52
Chris@102 53 BOOST_MPL_ASSERT(( boost::mpl::equal<combinations, result_types> ));
Chris@102 54 \endcode
Chris@102 55 */
Chris@102 56 template <typename Sequence1, typename Sequence2, typename Pred>
Chris@102 57 struct combine_if
Chris@102 58 {
Chris@102 59 struct combine
Chris@102 60 {
Chris@102 61 template <typename Result, typename T>
Chris@102 62 struct apply
Chris@102 63 {
Chris@102 64 typedef typename boost::mpl::fold<Sequence2, Result,
Chris@102 65 boost::mpl::if_
Chris@102 66 <
Chris@102 67 boost::mpl::bind
Chris@102 68 <
Chris@102 69 typename boost::mpl::lambda<Pred>::type,
Chris@102 70 T,
Chris@102 71 boost::mpl::_2
Chris@102 72 >,
Chris@102 73 boost::mpl::insert
Chris@102 74 <
Chris@102 75 boost::mpl::_1, boost::mpl::pair<T, boost::mpl::_2>
Chris@102 76 >,
Chris@102 77 boost::mpl::_1
Chris@102 78 >
Chris@102 79 >::type type;
Chris@102 80 };
Chris@102 81 };
Chris@102 82
Chris@102 83 typedef typename boost::mpl::fold
Chris@102 84 <
Chris@102 85 Sequence1, boost::mpl::set0<>, combine
Chris@102 86 >::type type;
Chris@102 87 };
Chris@102 88
Chris@102 89
Chris@102 90 } // namespace util
Chris@102 91
Chris@102 92 }} // namespace boost::geometry
Chris@102 93
Chris@102 94 #endif // BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP