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-2020.
6 // Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
19 #define BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP
21 #include <boost/config/pragma_message.hpp>
22 #if !defined(BOOST_ALLOW_DEPRECATED_HEADERS)
23 BOOST_PRAGMA_MESSAGE("This header is deprecated.")
26 #include <boost/mpl/bind.hpp>
27 #include <boost/mpl/fold.hpp>
28 #include <boost/mpl/if.hpp>
29 #include <boost/mpl/insert.hpp>
30 #include <boost/mpl/pair.hpp>
31 #include <boost/mpl/placeholders.hpp>
32 #include <boost/mpl/set.hpp>
34 namespace boost { namespace geometry
42 \brief Meta-function to generate all the combination of pairs of types
43 from a given sequence Sequence except those that does not satisfy the
48 typedef boost::mpl::vector<boost::mpl::int_<0>, boost::mpl::int_<1> > types;
49 typedef combine_if<types, types, always<true_> >::type combinations;
50 typedef boost::mpl::vector<
51 pair<boost::mpl::int_<1>, boost::mpl::int_<1> >,
52 pair<boost::mpl::int_<1>, boost::mpl::int_<0> >,
53 pair<boost::mpl::int_<0>, boost::mpl::int_<1> >,
54 pair<boost::mpl::int_<0>, boost::mpl::int_<0> >
57 BOOST_MPL_ASSERT(( boost::mpl::equal<combinations, result_types> ));
60 template <typename Sequence1, typename Sequence2, typename Pred>
65 template <typename Result, typename T>
68 typedef typename boost::mpl::fold<Sequence2, Result,
73 typename boost::mpl::lambda<Pred>::type,
79 boost::mpl::_1, boost::mpl::pair<T, boost::mpl::_2>
87 typedef typename boost::mpl::fold
89 Sequence1, boost::mpl::set0<>, combine
96 }} // namespace boost::geometry
98 #endif // BOOST_GEOMETRY_UTIL_COMBINE_IF_HPP