File indexing completed on 2025-02-25 09:44:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef BOOST_GEOMETRY_UTIL_COMPRESS_VARIANT_HPP
0021 #define BOOST_GEOMETRY_UTIL_COMPRESS_VARIANT_HPP
0022
0023 #include <boost/config/pragma_message.hpp>
0024 #if !defined(BOOST_ALLOW_DEPRECATED_HEADERS)
0025 BOOST_PRAGMA_MESSAGE("This header is deprecated.")
0026 #endif
0027
0028 #include <boost/mpl/equal_to.hpp>
0029 #include <boost/mpl/fold.hpp>
0030 #include <boost/mpl/front.hpp>
0031 #include <boost/mpl/if.hpp>
0032 #include <boost/mpl/insert.hpp>
0033 #include <boost/mpl/int.hpp>
0034 #include <boost/mpl/set.hpp>
0035 #include <boost/mpl/size.hpp>
0036 #include <boost/mpl/vector.hpp>
0037 #include <boost/variant/variant_fwd.hpp>
0038
0039
0040 namespace boost { namespace geometry
0041 {
0042
0043
0044 namespace detail
0045 {
0046
0047 template <typename Variant>
0048 struct unique_types:
0049 boost::mpl::fold<
0050 typename boost::mpl::reverse_fold<
0051 typename Variant::types,
0052 boost::mpl::set<>,
0053 boost::mpl::insert<
0054 boost::mpl::placeholders::_1,
0055 boost::mpl::placeholders::_2
0056 >
0057 >::type,
0058 boost::mpl::vector<>,
0059 boost::mpl::push_back
0060 <
0061 boost::mpl::placeholders::_1, boost::mpl::placeholders::_2
0062 >
0063 >
0064 {};
0065
0066 template <typename Types>
0067 struct variant_or_single:
0068 boost::mpl::if_<
0069 boost::mpl::equal_to<
0070 boost::mpl::size<Types>,
0071 boost::mpl::int_<1>
0072 >,
0073 typename boost::mpl::front<Types>::type,
0074 typename make_variant_over<Types>::type
0075 >
0076 {};
0077
0078 }
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 template <typename Variant>
0101 struct compress_variant:
0102 detail::variant_or_single<
0103 typename detail::unique_types<Variant>::type
0104 >
0105 {};
0106
0107
0108 }}
0109
0110
0111 #endif