1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
5 // This file was modified by Oracle on 2015.
6 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
10 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
11 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13 // Use, modification and distribution is subject to the Boost Software License,
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 #ifndef BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
18 #define BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
20 #include <boost/mpl/fold.hpp>
21 #include <boost/mpl/if.hpp>
22 #include <boost/mpl/bind.hpp>
23 #include <boost/mpl/set.hpp>
24 #include <boost/mpl/insert.hpp>
25 #include <boost/mpl/placeholders.hpp>
28 namespace boost { namespace geometry
36 \brief Meta-function to generate all the combination of pairs of types
37 from a given sequence Sequence except those that does not satisfy the
42 typedef boost::mpl::vector<boost::mpl::int_<0>, boost::mpl::int_<1> > types;
43 typedef combine_if<types, types, always<true_> >::type combinations;
44 typedef boost::mpl::vector<
45 pair<boost::mpl::int_<1>, boost::mpl::int_<1> >,
46 pair<boost::mpl::int_<1>, boost::mpl::int_<0> >,
47 pair<boost::mpl::int_<0>, boost::mpl::int_<1> >,
48 pair<boost::mpl::int_<0>, boost::mpl::int_<0> >
51 BOOST_MPL_ASSERT(( boost::mpl::equal<combinations, result_types> ));
54 template <typename Sequence1, typename Sequence2, typename Pred>
59 template <typename Result, typename T>
62 typedef typename boost::mpl::fold<Sequence2, Result,
67 typename boost::mpl::lambda<Pred>::type,
73 boost::mpl::_1, boost::mpl::pair<T, boost::mpl::_2>
81 typedef typename boost::mpl::fold
83 Sequence1, boost::mpl::set0<>, combine
90 }} // namespace boost::geometry
92 #endif // BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP