diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp index 40e19ec71..c17fcb863 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp @@ -118,16 +118,16 @@ public: bool is_p_last, bool is_q_last, EqPPStrategy const& strategy) { - int arrival_a = result.template get<1>().arrival[0]; - int arrival_b = result.template get<1>().arrival[1]; - bool same_dirs = result.template get<1>().dir_a == 0 - && result.template get<1>().dir_b == 0; + int arrival_a = result.direction.arrival[0]; + int arrival_b = result.direction.arrival[1]; + bool same_dirs = result.direction.dir_a == 0 + && result.direction.dir_b == 0; if ( same_dirs ) { - if ( result.template get<0>().count == 2 ) + if ( result.intersection_points.count == 2 ) { - if ( ! result.template get<1>().opposite ) + if ( ! result.direction.opposite ) { ips[0].p_operation = operation_intersection; ips[0].q_operation = operation_intersection; @@ -136,10 +136,10 @@ public: ips[0].is_pi = equals::equals_point_point( - pi, result.template get<0>().intersections[0], strategy); + pi, result.intersection_points.intersections[0], strategy); ips[0].is_qi = equals::equals_point_point( - qi, result.template get<0>().intersections[0], strategy); + qi, result.intersection_points.intersections[0], strategy); ips[1].is_pj = arrival_a != -1; ips[1].is_qj = arrival_b != -1; } @@ -158,7 +158,7 @@ public: } else { - BOOST_GEOMETRY_ASSERT(result.template get<0>().count == 1); + BOOST_GEOMETRY_ASSERT(result.intersection_points.count == 1); ips[0].p_operation = union_or_blocked_same_dirs(arrival_a, is_p_last); ips[0].q_operation = union_or_blocked_same_dirs(arrival_b, is_q_last); @@ -542,19 +542,19 @@ struct get_turn_info_for_endpoint //geometry::convert(ip, tp.point); //tp.method = method; - base_turn_handler::assign_point(tp, method, result.template get<0>(), ip_index); + base_turn_handler::assign_point(tp, method, result.intersection_points, ip_index); tp.operations[0].operation = op0; tp.operations[1].operation = op1; tp.operations[0].position = pos0; tp.operations[1].position = pos1; - if ( result.template get<0>().count > 1 ) + if ( result.intersection_points.count > 1 ) { // NOTE: is_collinear is NOT set for the first endpoint // for which there is no preceding segment - //BOOST_GEOMETRY_ASSERT( result.template get<1>().dir_a == 0 && result.template get<1>().dir_b == 0 ); + //BOOST_GEOMETRY_ASSERT( result.direction.dir_a == 0 && result.direction.dir_b == 0 ); if ( ! is_p_first_ip ) { tp.operations[0].is_collinear = op0 != operation_intersection @@ -567,7 +567,7 @@ struct get_turn_info_for_endpoint || is_q_spike; } } - else //if ( result.template get<0>().count == 1 ) + else //if ( result.intersection_points.count == 1 ) { if ( op0 == operation_blocked && op1 == operation_intersection ) { diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp index 0ae041eb3..76e0f0258 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp @@ -18,9 +18,7 @@ #include #include #include -#include -#include -#include +#include #include #include @@ -248,13 +246,9 @@ public: TurnPoint, geometry::segment_ratio > intersection_point_type; - typedef policies::relate::segments_tupled + typedef policies::relate::segments_intersection_policy < - policies::relate::segments_intersection_points - < - intersection_point_type - >, - policies::relate::segments_direction + intersection_point_type > intersection_policy_type; typedef typename intersection_policy_type::return_type result_type; @@ -343,13 +337,9 @@ class intersection_info_base intersection_point_type; - typedef policies::relate::segments_tupled + typedef policies::relate::segments_intersection_policy < - policies::relate::segments_intersection_points - < - intersection_point_type - >, - policies::relate::segments_direction + intersection_point_type > intersection_policy_type; typedef typename intersection_policy_type::return_type result_type; @@ -439,22 +429,21 @@ public: typedef typename base::side_calculator_type side_calculator_type; typedef typename base::result_type result_type; - typedef typename boost::tuples::element<0, result_type>::type i_info_type; // intersection_info - typedef typename boost::tuples::element<1, result_type>::type d_info_type; // dir_info + typedef typename result_type::intersection_points_type i_info_type; + typedef typename result_type::direction_type d_info_type; intersection_info(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, UmbrellaStrategy const& umbrella_strategy, RobustPolicy const& robust_policy) - : base(range_p, range_q, - umbrella_strategy, robust_policy) + : base(range_p, range_q, umbrella_strategy, robust_policy) , m_intersection_strategy(umbrella_strategy) , m_robust_policy(robust_policy) {} inline result_type const& result() const { return base::m_result; } - inline i_info_type const& i_info() const { return base::m_result.template get<0>(); } - inline d_info_type const& d_info() const { return base::m_result.template get<1>(); } + inline i_info_type const& i_info() const { return base::m_result.intersection_points; } + inline d_info_type const& d_info() const { return base::m_result.direction; } inline side_strategy_type get_side_strategy() const { diff --git a/include/boost/geometry/algorithms/detail/relate/de9im.hpp b/include/boost/geometry/algorithms/detail/relate/de9im.hpp index 38e880dbb..a89d46100 100644 --- a/include/boost/geometry/algorithms/detail/relate/de9im.hpp +++ b/include/boost/geometry/algorithms/detail/relate/de9im.hpp @@ -14,8 +14,7 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_DE9IM_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_DE9IM_HPP -#include -#include +#include #include #include @@ -153,33 +152,20 @@ class static_mask inline -boost::tuples::cons - < - mask, - boost::tuples::cons - > +std::tuple operator||(mask const& m1, mask const& m2) { - namespace bt = boost::tuples; - - return bt::cons > - ( m1, bt::cons(m2, bt::null_type()) ); + return std::tuple(m1, m2); } -template +template inline -typename geometry::tuples::push_back - < - boost::tuples::cons, - mask - >::type -operator||(boost::tuples::cons const& t, mask const& m) +std::tuple +operator||(std::tuple const& t, mask const& m) { - namespace bt = boost::tuples; - return geometry::tuples::push_back < - bt::cons, + std::tuple, mask >::apply(t, m); } diff --git a/include/boost/geometry/algorithms/detail/relate/interface.hpp b/include/boost/geometry/algorithms/detail/relate/interface.hpp index ad4a68ff7..1c06d65d5 100644 --- a/include/boost/geometry/algorithms/detail/relate/interface.hpp +++ b/include/boost/geometry/algorithms/detail/relate/interface.hpp @@ -15,7 +15,8 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_INTERFACE_HPP -#include +#include + #include #include #include @@ -104,12 +105,12 @@ struct result_handler_type > type; }; -template -struct result_handler_type> +template +struct result_handler_type> { typedef mask_handler < - boost::tuples::cons, + std::tuple, interruption_enabled < Geometry1, diff --git a/include/boost/geometry/algorithms/detail/relate/result.hpp b/include/boost/geometry/algorithms/detail/relate/result.hpp index 52ef3bd77..03bdb8384 100644 --- a/include/boost/geometry/algorithms/detail/relate/result.hpp +++ b/include/boost/geometry/algorithms/detail/relate/result.hpp @@ -308,14 +308,14 @@ struct interrupt_dispatch } }; -template ::value> +template ::value> struct interrupt_dispatch_tuple { template static inline bool apply(Masks const& masks) { - typedef typename boost::tuples::element::type mask_type; - mask_type const& mask = boost::get(masks); + typedef typename std::tuple_element::type mask_type; + mask_type const& mask = std::get(masks); return interrupt_dispatch::template apply(mask) && interrupt_dispatch_tuple::template apply(masks); } @@ -331,23 +331,10 @@ struct interrupt_dispatch_tuple } }; -//template -//struct interrupt_dispatch, true> -//{ -// typedef boost::tuple mask_type; - -// template -// static inline bool apply(mask_type const& mask) -// { -// return interrupt_dispatch_tuple::template apply(mask); -// } -//}; - -template -struct interrupt_dispatch, true> +template +struct interrupt_dispatch, true> { - typedef boost::tuples::cons mask_type; + typedef std::tuple mask_type; template static inline bool apply(mask_type const& mask) @@ -394,14 +381,14 @@ struct may_update_dispatch } }; -template ::value> +template ::value> struct may_update_dispatch_tuple { template static inline bool apply(Masks const& masks, Matrix const& matrix) { - typedef typename boost::tuples::element::type mask_type; - mask_type const& mask = boost::get(masks); + typedef typename std::tuple_element::type mask_type; + mask_type const& mask = std::get(masks); return may_update_dispatch::template apply(mask, matrix) || may_update_dispatch_tuple::template apply(masks, matrix); } @@ -417,23 +404,10 @@ struct may_update_dispatch_tuple } }; -//template -//struct may_update_dispatch< boost::tuple > -//{ -// typedef boost::tuple mask_type; - -// template -// static inline bool apply(mask_type const& mask, Matrix const& matrix) -// { -// return may_update_dispatch_tuple::template apply(mask, matrix); -// } -//}; - -template -struct may_update_dispatch< boost::tuples::cons > +template +struct may_update_dispatch> { - typedef boost::tuples::cons mask_type; + typedef std::tuple mask_type; template static inline bool apply(mask_type const& mask, Matrix const& matrix) @@ -491,14 +465,14 @@ struct check_dispatch } }; -template ::value> +template ::value> struct check_dispatch_tuple { template static inline bool apply(Masks const& masks, Matrix const& matrix) { - typedef typename boost::tuples::element::type mask_type; - mask_type const& mask = boost::get(masks); + typedef typename std::tuple_element::type mask_type; + mask_type const& mask = std::get(masks); return check_dispatch::apply(mask, matrix) || check_dispatch_tuple::apply(masks, matrix); } @@ -514,23 +488,10 @@ struct check_dispatch_tuple } }; -//template -//struct check_dispatch< boost::tuple > -//{ -// typedef boost::tuple mask_type; - -// template -// static inline bool apply(mask_type const& mask, Matrix const& matrix) -// { -// return check_dispatch_tuple::apply(mask, matrix); -// } -//}; - -template -struct check_dispatch< boost::tuples::cons > +template +struct check_dispatch> { - typedef boost::tuples::cons mask_type; + typedef std::tuple mask_type; template static inline bool apply(mask_type const& mask, Matrix const& matrix) @@ -555,11 +516,11 @@ struct matrix_width template ::value> + int N = std::tuple_size::value> struct matrix_width_tuple { static const std::size_t - current = matrix_width::type>::value; + current = matrix_width::type>::value; static const std::size_t next = matrix_width_tuple::value; @@ -573,11 +534,11 @@ struct matrix_width_tuple static const std::size_t value = 0; }; -template -struct matrix_width< boost::tuples::cons > +template +struct matrix_width> { static const std::size_t - value = matrix_width_tuple< boost::tuples::cons >::value; + value = matrix_width_tuple>::value; }; // mask_handler diff --git a/include/boost/geometry/algorithms/detail/tupled_output.hpp b/include/boost/geometry/algorithms/detail/tupled_output.hpp index da6f9bb2f..e0f889745 100644 --- a/include/boost/geometry/algorithms/detail/tupled_output.hpp +++ b/include/boost/geometry/algorithms/detail/tupled_output.hpp @@ -86,45 +86,10 @@ struct is_tupled_single_output_check {}; -// true if Output is boost::tuple, boost::tuples::cons, std::pair or std::tuple -template -struct is_tupled - : util::bool_constant -{}; - -template -< - class T0, class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8, class T9 -> -struct is_tupled > - : util::bool_constant -{}; - -template -struct is_tupled > - : util::bool_constant -{}; - -template -struct is_tupled > - : util::bool_constant -{}; - -#ifdef BOOST_GEOMETRY_CXX11_TUPLE - -template -struct is_tupled > - : util::bool_constant -{}; - -#endif // BOOST_GEOMETRY_CXX11_TUPLE - - // true if Output is boost::tuple, boost::tuples::cons, std::pair or std::tuple // and is_tupled_output_check defiend above passes -template ::value> +template ::value> struct is_tupled_output : util::bool_constant {}; @@ -137,7 +102,7 @@ struct is_tupled_output // true if T is boost::tuple, boost::tuples::cons, std::pair or std::tuple // and is_tupled_single_output_check defiend above passes -template ::value> +template ::value> struct is_tupled_single_output : util::bool_constant {}; @@ -204,35 +169,15 @@ tupled_output_get(Output & output) // defines a tuple-type holding value-types of ranges being elements of // Output pair/tuple -template -< - typename Tuple, - size_t I = 0, - size_t N = geometry::tuples::size::value -> -struct tupled_range_values_bt -{ - typedef boost::tuples::cons - < - typename boost::range_value - < - typename geometry::tuples::element::type - >::type, - typename tupled_range_values_bt::type - > type; -}; +template +struct tupled_range_values; -template -struct tupled_range_values_bt +template +struct tupled_range_values > { - typedef boost::tuples::null_type type; + typedef std::tuple::type...> type; }; -template -struct tupled_range_values - : tupled_range_values_bt -{}; - template struct tupled_range_values > { @@ -243,74 +188,46 @@ struct tupled_range_values > > type; }; -#ifdef BOOST_GEOMETRY_CXX11_TUPLE - -template -struct tupled_range_values > +template +< + typename Tuple, + size_t I = 0, + size_t N = boost::tuples::length::value +> +struct tupled_range_values_bt { - typedef std::tuple::type...> type; + typedef boost::tuples::cons + < + typename boost::range_value + < + typename boost::tuples::element::type + >::type, + typename tupled_range_values_bt::type + > type; }; -#endif // BOOST_GEOMETRY_CXX11_TUPLE +template +struct tupled_range_values_bt +{ + typedef boost::tuples::null_type type; +}; + +template +struct tupled_range_values> + : tupled_range_values_bt> +{}; + +template +struct tupled_range_values> + : tupled_range_values_bt> +{}; // util defining a type and creating a tuple holding back-insert-iterators to // ranges being elements of Output pair/tuple -template ::value> -struct tupled_back_inserters_bt -{ - typedef boost::tuples::cons - < - geometry::range::back_insert_iterator - < - typename geometry::tuples::element::type - >, - typename tupled_back_inserters_bt::type - > type; - - static type apply(Tuple & tup) - { - return type(geometry::range::back_inserter(geometry::tuples::get(tup)), - tupled_back_inserters_bt::apply(tup)); - } -}; - -template -struct tupled_back_inserters_bt -{ - typedef boost::tuples::null_type type; - - static type apply(Tuple const&) - { - return type(); - } -}; - template -struct tupled_back_inserters - : tupled_back_inserters_bt -{}; - -template -struct tupled_back_inserters > -{ - typedef std::pair - < - geometry::range::back_insert_iterator, - geometry::range::back_insert_iterator - > type; - - static type apply(std::pair & p) - { - return type(geometry::range::back_inserter(p.first), - geometry::range::back_inserter(p.second)); - } -}; - -#ifdef BOOST_GEOMETRY_CXX11_TUPLE +struct tupled_back_inserters; template struct tupled_back_inserters_st; @@ -335,7 +252,63 @@ struct tupled_back_inserters > > {}; -#endif // BOOST_GEOMETRY_CXX11_TUPLE +template +struct tupled_back_inserters > +{ + typedef std::pair + < + geometry::range::back_insert_iterator, + geometry::range::back_insert_iterator + > type; + + static type apply(std::pair & p) + { + return type(geometry::range::back_inserter(p.first), + geometry::range::back_inserter(p.second)); + } +}; + +template ::value> +struct tupled_back_inserters_bt +{ + typedef boost::tuples::cons + < + geometry::range::back_insert_iterator + < + typename boost::tuples::element::type + >, + typename tupled_back_inserters_bt::type + > type; + + static type apply(Tuple & tup) + { + return type(geometry::range::back_inserter(boost::get(tup)), + tupled_back_inserters_bt::apply(tup)); + } +}; + +template +struct tupled_back_inserters_bt +{ + typedef boost::tuples::null_type type; + + static type apply(Tuple const&) + { + return type(); + } +}; + +template +struct tupled_back_inserters> + : tupled_back_inserters_bt> +{}; + +template +struct tupled_back_inserters> + : tupled_back_inserters_bt> +{}; template @@ -476,13 +449,14 @@ struct output_geometry_concept_check_t {} }; -template -< - class T0, class T1, class T2, class T3, class T4, - class T5, class T6, class T7, class T8, class T9 -> -struct output_geometry_concept_check > - : output_geometry_concept_check_t > +template +struct output_geometry_concept_check > + : output_geometry_concept_check_t > +{}; + +template +struct output_geometry_concept_check > + : output_geometry_concept_check_t > {}; template @@ -490,15 +464,6 @@ struct output_geometry_concept_check > : output_geometry_concept_check_t > {}; -#ifdef BOOST_GEOMETRY_CXX11_TUPLE - -template -struct output_geometry_concept_check > - : output_geometry_concept_check_t > -{}; - -#endif // BOOST_GEOMETRY_CXX11_TUPLE - struct tupled_output_tag {}; @@ -569,33 +534,10 @@ struct expect_output_assert template < typename Geometry1, typename Geometry2, typename TupledOut, - typename Tag1, - typename Tag2 = void, - typename Tag3 = void + typename ...Tags > struct expect_output - : expect_output_assert - , expect_output_assert - , expect_output_assert -{}; - -template -< - typename Geometry1, typename Geometry2, typename TupledOut, - typename Tag1, typename Tag2 -> -struct expect_output - : expect_output_assert - , expect_output_assert -{}; - -template -< - typename Geometry1, typename Geometry2, typename TupledOut, - typename Tag1 -> -struct expect_output - : expect_output_assert + : expect_output_assert... {}; diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index eb7384243..1318c1cf0 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -15,11 +15,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP +#include #include //#include -#include - #include #include @@ -524,22 +523,10 @@ struct predicates_length static const unsigned value = 1; }; -//template -//struct predicates_length< std::pair > -//{ -// static const unsigned value = 2; -//}; - -//template -//struct predicates_length< boost::tuple > -//{ -// static const unsigned value = boost::tuples::length< boost::tuple >::value; -//}; - -template -struct predicates_length< boost::tuples::cons > +template +struct predicates_length> { - static const unsigned value = boost::tuples::length< boost::tuples::cons >::value; + static const unsigned value = std::tuple_size>::value; }; // ------------------------------------------------------------------ // @@ -557,88 +544,19 @@ struct predicates_element static type const& get(T const& p) { return p; } }; -//template -//struct predicates_element< I, std::pair > -//{ -// BOOST_GEOMETRY_STATIC_ASSERT((I < 2), "INVALID_INDEX", std::integral_constant, F, S); -// -// typedef F type; -// static type const& get(std::pair const& p) { return p.first; } -//}; -// -//template -//struct predicates_element< 1, std::pair > -//{ -// typedef S type; -// static type const& get(std::pair const& p) { return p.second; } -//}; -// -//template -//struct predicates_element< I, boost::tuple > -//{ -// typedef boost::tuple predicate_type; -// -// typedef typename boost::tuples::element::type type; -// static type const& get(predicate_type const& p) { return boost::get(p); } -//}; - -template -struct predicates_element< I, boost::tuples::cons > +template +struct predicates_element> { - typedef boost::tuples::cons predicate_type; + typedef std::tuple predicate_type; - typedef typename boost::tuples::element::type type; - static type const& get(predicate_type const& p) { return boost::get(p); } + typedef typename std::tuple_element::type type; + static type const& get(predicate_type const& p) { return std::get(p); } }; // ------------------------------------------------------------------ // // predicates_check // ------------------------------------------------------------------ // -//template -//struct predicates_check_pair {}; -// -//template -//struct predicates_check_pair -//{ -// template -// static inline bool apply(PairPredicates const& , Value const& , Indexable const& ) -// { -// return true; -// } -//}; -// -//template -//struct predicates_check_pair -//{ -// template -// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) -// { -// return predicate_check::apply(p.first, v, i); -// } -//}; -// -//template -//struct predicates_check_pair -//{ -// template -// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) -// { -// return predicate_check::apply(p.second, v, i); -// } -//}; -// -//template -//struct predicates_check_pair -//{ -// template -// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i) -// { -// return predicate_check::apply(p.first, v, i) -// && predicate_check::apply(p.second, v, i); -// } -//}; - template struct predicates_check_tuple { @@ -647,9 +565,9 @@ struct predicates_check_tuple { return predicate_check < - typename boost::tuples::element::type, + typename std::tuple_element::type, Tag - >::apply(boost::get(p), v, i, s) + >::apply(std::get(p), v, i, s) && predicates_check_tuple::apply(p, v, i, s); } }; @@ -679,57 +597,12 @@ struct predicates_check_impl } }; -//template -//struct predicates_check_impl, Tag, First, Last> -//{ -// BOOST_GEOMETRY_STATIC_ASSERT((First < 2 && Last <= 2 && First <= Last), -// "INVALID_INDEXES", -// std::integer_sequence); -// -// template -// static inline bool apply(std::pair const& p, Value const& v, Indexable const& i) -// { -// return predicate_check::apply(p.first, v, i) -// && predicate_check::apply(p.second, v, i); -// } -//}; -// -//template < -// typename T0, typename T1, typename T2, typename T3, typename T4, -// typename T5, typename T6, typename T7, typename T8, typename T9, -// typename Tag, unsigned First, unsigned Last -//> -//struct predicates_check_impl< -// boost::tuple, -// Tag, First, Last -//> -//{ -// typedef boost::tuple predicates_type; -// -// static const unsigned pred_len = boost::tuples::length::value; -// BOOST_GEOMETRY_STATIC_ASSERT((First < pred_len && Last <= pred_len && First <= Last), -// "INVALID_INDEXES", -// std::integer_sequence); -// -// template -// static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i) -// { -// return predicates_check_tuple< -// predicates_type, -// Tag, First, Last -// >::apply(p, v, i); -// } -//}; - -template -struct predicates_check_impl< - boost::tuples::cons, - Tag, First, Last -> +template +struct predicates_check_impl, Tag, First, Last> { - typedef boost::tuples::cons predicates_type; + typedef std::tuple predicates_type; - static const unsigned pred_len = boost::tuples::length::value; + static const unsigned pred_len = std::tuple_size::value; static const bool check = First < pred_len && Last <= pred_len && First <= Last; BOOST_GEOMETRY_STATIC_ASSERT((check), "Invalid First or Last index.", @@ -738,10 +611,11 @@ struct predicates_check_impl< template static inline bool apply(predicates_type const& p, Value const& v, Indexable const& i, Strategy const& s) { - return predicates_check_tuple< - predicates_type, - Tag, First, Last - >::apply(p, v, i, s); + return predicates_check_tuple + < + predicates_type, + Tag, First, Last + >::apply(p, v, i, s); } }; @@ -784,18 +658,11 @@ struct predicates_count_distance static const unsigned value = predicates_is_distance::value; }; -//template -//struct predicates_count_distance< std::pair > -//{ -// static const unsigned value = predicates_is_distance::value -// + predicates_is_distance::value; -//}; - template struct predicates_count_distance_tuple { static const unsigned value = - predicates_is_distance::type>::value + predicates_is_distance::type>::value + predicates_count_distance_tuple::value; }; @@ -803,24 +670,15 @@ template struct predicates_count_distance_tuple { static const unsigned value = - predicates_is_distance::type>::value; + predicates_is_distance::type>::value; }; -//template -//struct predicates_count_distance< boost::tuple > -//{ -// static const unsigned value = predicates_count_distance_tuple< -// boost::tuple, -// boost::tuples::length< boost::tuple >::value -// >::value; -//}; - -template -struct predicates_count_distance< boost::tuples::cons > +template +struct predicates_count_distance> { static const unsigned value = predicates_count_distance_tuple< - boost::tuples::cons, - boost::tuples::length< boost::tuples::cons >::value + std::tuple, + std::tuple_size>::value >::value; }; @@ -832,47 +690,31 @@ struct predicates_find_distance static const unsigned value = predicates_is_distance::value ? 0 : 1; }; -//template -//struct predicates_find_distance< std::pair > -//{ -// static const unsigned value = predicates_is_distance::value ? 0 : -// (predicates_is_distance::value ? 1 : 2); -//}; - template struct predicates_find_distance_tuple { static const bool is_found = predicates_find_distance_tuple::is_found - || predicates_is_distance::type>::value; + || predicates_is_distance::type>::value; static const unsigned value = predicates_find_distance_tuple::is_found ? predicates_find_distance_tuple::value : - (predicates_is_distance::type>::value ? - N-1 : boost::tuples::length::value); + (predicates_is_distance::type>::value ? + N-1 : std::tuple_size::value); }; template struct predicates_find_distance_tuple { - static const bool is_found = predicates_is_distance::type>::value; - static const unsigned value = is_found ? 0 : boost::tuples::length::value; + static const bool is_found = predicates_is_distance::type>::value; + static const unsigned value = is_found ? 0 : std::tuple_size::value; }; -//template -//struct predicates_find_distance< boost::tuple > -//{ -// static const unsigned value = predicates_find_distance_tuple< -// boost::tuple, -// boost::tuples::length< boost::tuple >::value -// >::value; -//}; - -template -struct predicates_find_distance< boost::tuples::cons > +template +struct predicates_find_distance> { static const unsigned value = predicates_find_distance_tuple< - boost::tuples::cons, - boost::tuples::length< boost::tuples::cons >::value + std::tuple, + std::tuple_size>::value >::value; }; diff --git a/include/boost/geometry/index/detail/rtree/utilities/statistics.hpp b/include/boost/geometry/index/detail/rtree/utilities/statistics.hpp index 169253510..17c2c2033 100644 --- a/include/boost/geometry/index/detail/rtree/utilities/statistics.hpp +++ b/include/boost/geometry/index/detail/rtree/utilities/statistics.hpp @@ -5,8 +5,8 @@ // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013 Mateusz Loskot, London, UK. // -// This file was modified by Oracle on 2019. -// Modifications copyright (c) 2019 Oracle and/or its affiliates. +// This file was modified by Oracle on 2019-2020. +// Modifications copyright (c) 2019-2020 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // // Use, modification and distribution is subject to the Boost Software License, @@ -17,7 +17,7 @@ #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_UTILITIES_STATISTICS_HPP #include -#include +#include namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace utilities { @@ -87,7 +87,7 @@ struct statistics } // namespace visitors template inline -boost::tuple +std::tuple statistics(Rtree const& tree) { typedef utilities::view RTV; @@ -99,7 +99,7 @@ statistics(Rtree const& tree) rtv.apply_visitor(stats_v); - return boost::make_tuple(stats_v.levels, stats_v.nodes, stats_v.leaves, stats_v.values, stats_v.values_min, stats_v.values_max); + return std::make_tuple(stats_v.levels, stats_v.nodes, stats_v.leaves, stats_v.values, stats_v.values_min, stats_v.values_max); } }}}}}} // namespace boost::geometry::index::detail::rtree::utilities diff --git a/include/boost/geometry/index/predicates.hpp b/include/boost/geometry/index/predicates.hpp index 240533f4e..09faaaf20 100644 --- a/include/boost/geometry/index/predicates.hpp +++ b/include/boost/geometry/index/predicates.hpp @@ -396,34 +396,26 @@ operator!(spatial_predicate const& p) // operator&& generators template inline -boost::tuples::cons< - Pred1, - boost::tuples::cons -> +std::tuple operator&&(Pred1 const& p1, Pred2 const& p2) { /*typedef std::conditional_t::value, Pred1, Pred1 const&> stored1; typedef std::conditional_t::value, Pred2, Pred2 const&> stored2;*/ - namespace bt = boost::tuples; - - return - bt::cons< Pred1, bt::cons > - ( p1, bt::cons(p2, bt::null_type()) ); + return std::tuple(p1, p2); } -template inline -typename geometry::tuples::push_back< - boost::tuples::cons, Pred ->::type -operator&&(boost::tuples::cons const& t, Pred const& p) +template inline +typename geometry::tuples::push_back + < + std::tuple, Pred + >::type +operator&&(std::tuple const& t, Pred const& p) { //typedef std::conditional_t::value, Pred, Pred const&> stored; - namespace bt = boost::tuples; - - return - geometry::tuples::push_back< - bt::cons, Pred - >::apply(t, p); + return geometry::tuples::push_back + < + std::tuple, Pred + >::apply(t, p); } }} // namespace detail::predicates diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 950acd99d..1f54afac1 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -118,7 +118,7 @@ algorithm with specific parameters like min and max number of elements in node. \par Predefined algorithms with compile-time parameters are: -\li boost::geometry::index::linear, + \li boost::geometry::index::linear, \li boost::geometry::index::quadratic, \li boost::geometry::index::rstar. @@ -135,8 +135,8 @@ access. Therefore the IndexableGetter should return the Indexable by a reference type. The Indexable should not be calculated since it could harm the performance. The default IndexableGetter can translate all types adapted to Point, Box or Segment concepts (called Indexables). Furthermore, it can -handle std::pair, boost::tuple -and std::tuple when possible. For example, for Value +handle std::pair, std::tuple +and boost::tuple. For example, for Value of type std::pair, the default IndexableGetter translates from std::pair const& to Box const&. diff --git a/include/boost/geometry/policies/relate/intersection_policy.hpp b/include/boost/geometry/policies/relate/intersection_policy.hpp new file mode 100644 index 000000000..6afffc20c --- /dev/null +++ b/include/boost/geometry/policies/relate/intersection_policy.hpp @@ -0,0 +1,139 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2020 Barend Gehrels, Amsterdam, the Netherlands. + +// This file was modified by Oracle on 2020. +// Modifications copyright (c) 2020 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP +#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP + + +#include +#include + +#include +#include + +#include + +namespace boost { namespace geometry +{ + +namespace policies { namespace relate +{ + + +template +struct segments_intersection_policy +{ +private: + typedef policies::relate::segments_intersection_points + < + IntersectionPointsReturnType + > pts_policy; + typedef policies::relate::segments_direction dir_policy; + +public: + struct return_type + { + typedef typename pts_policy::return_type intersection_points_type; + typedef typename dir_policy::return_type direction_type; + + return_type(intersection_points_type const& pts_result, + direction_type const& dir_result) + : intersection_points(pts_result) + , direction(dir_result) + {} + + intersection_points_type intersection_points; + direction_type direction; + }; + + template + static inline return_type segments_crosses(side_info const& sides, + SegmentIntersectionInfo const& sinfo, + Segment1 const& s1, Segment2 const& s2) + { + return return_type + ( + pts_policy::segments_crosses(sides, sinfo, s1, s2), + dir_policy::segments_crosses(sides, sinfo, s1, s2) + ); + } + + template + static inline return_type segments_collinear( + Segment1 const& segment1, + Segment2 const& segment2, + bool opposite, + int pa1, int pa2, int pb1, int pb2, + Ratio const& ra1, Ratio const& ra2, + Ratio const& rb1, Ratio const& rb2) + { + return return_type + ( + pts_policy::segments_collinear(segment1, segment2, + opposite, + pa1, pa2, pb1, pb2, + ra1, ra2, rb1, rb2), + dir_policy::segments_collinear(segment1, segment2, + opposite, + pa1, pa2, pb1, pb2, + ra1, ra2, rb1, rb2) + ); + } + + template + static inline return_type degenerate(Segment const& segment, + bool a_degenerate) + { + return return_type + ( + pts_policy::degenerate(segment, a_degenerate), + dir_policy::degenerate(segment, a_degenerate) + ); + } + + template + static inline return_type one_degenerate(Segment const& segment, + Ratio const& ratio, + bool a_degenerate) + { + return return_type + ( + pts_policy::one_degenerate(segment, ratio, a_degenerate), + dir_policy::one_degenerate(segment, ratio, a_degenerate) + ); + } + + static inline return_type disjoint() + { + return return_type + ( + pts_policy::disjoint(), + dir_policy::disjoint() + ); + } + + static inline return_type error(std::string const& msg) + { + return return_type + ( + pts_policy::error(msg), + dir_policy::error(msg) + ); + } +}; + + +}} // namespace policies::relate + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP diff --git a/include/boost/geometry/policies/relate/tupled.hpp b/include/boost/geometry/policies/relate/tupled.hpp deleted file mode 100644 index 4b65432f2..000000000 --- a/include/boost/geometry/policies/relate/tupled.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. - -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP -#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP - - -#include - -#include -#include - -namespace boost { namespace geometry -{ - -namespace policies { namespace relate -{ - - -// "tupled" to return intersection results together. -// Now with two, with some meta-programming and derivations it can also be three (or more) -template -struct segments_tupled -{ - typedef boost::tuple - < - typename Policy1::return_type, - typename Policy2::return_type - > return_type; - - template - static inline return_type segments_crosses(side_info const& sides, - SegmentIntersectionInfo const& sinfo, - Segment1 const& s1, Segment2 const& s2) - { - return boost::make_tuple - ( - Policy1::segments_crosses(sides, sinfo, s1, s2), - Policy2::segments_crosses(sides, sinfo, s1, s2) - ); - } - - template - static inline return_type segments_collinear( - Segment1 const& segment1, Segment2 const& segment2, - bool opposite, - int pa1, int pa2, int pb1, int pb2, - Ratio const& ra1, Ratio const& ra2, - Ratio const& rb1, Ratio const& rb2) - { - return boost::make_tuple - ( - Policy1::segments_collinear(segment1, segment2, - opposite, - pa1, pa2, pb1, pb2, - ra1, ra2, rb1, rb2), - Policy2::segments_collinear(segment1, segment2, - opposite, - pa1, pa2, pb1, pb2, - ra1, ra2, rb1, rb2) - ); - } - - template - static inline return_type degenerate(Segment const& segment, - bool a_degenerate) - { - return boost::make_tuple - ( - Policy1::degenerate(segment, a_degenerate), - Policy2::degenerate(segment, a_degenerate) - ); - } - - template - static inline return_type one_degenerate(Segment const& segment, - Ratio const& ratio, - bool a_degenerate) - { - return boost::make_tuple - ( - Policy1::one_degenerate(segment, ratio, a_degenerate), - Policy2::one_degenerate(segment, ratio, a_degenerate) - ); - } - - static inline return_type disjoint() - { - return boost::make_tuple - ( - Policy1::disjoint(), - Policy2::disjoint() - ); - } - - static inline return_type error(std::string const& msg) - { - return boost::make_tuple - ( - Policy1::error(msg), - Policy2::error(msg) - ); - } - -}; - -}} // namespace policies::relate - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP diff --git a/include/boost/geometry/srs/projection.hpp b/include/boost/geometry/srs/projection.hpp index 3d8193f9b..cbb91642a 100644 --- a/include/boost/geometry/srs/projection.hpp +++ b/include/boost/geometry/srs/projection.hpp @@ -416,11 +416,11 @@ private: projection_type m_proj; }; -template -class proj_wrapper, CT> - : public static_proj_wrapper_base, CT> +template +class proj_wrapper, CT> + : public static_proj_wrapper_base, CT> { - typedef srs::spar::parameters + typedef srs::spar::parameters static_parameters_type; typedef static_proj_wrapper_base < diff --git a/include/boost/geometry/srs/projections/impl/pj_datum_set.hpp b/include/boost/geometry/srs/projections/impl/pj_datum_set.hpp index 2c27d5514..e44491e25 100644 --- a/include/boost/geometry/srs/projections/impl/pj_datum_set.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_datum_set.hpp @@ -161,12 +161,12 @@ struct pj_datum_find_datum_static } }; -template -inline const pj_datums_type* pj_datum_find_datum(srs::spar::parameters const& params) +template +inline const pj_datums_type* pj_datum_find_datum(srs::spar::parameters const& params) { return pj_datum_find_datum_static < - srs::spar::parameters + srs::spar::parameters >::template apply(params); } @@ -219,13 +219,13 @@ template Params, srs::spar::detail::is_param::pred >::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_datum_find_nadgrids_static { static void apply(Params const& params, srs::detail::nadgrids & out) { - out = boost::tuples::get(params); + out = geometry::tuples::get(params); } }; template @@ -235,13 +235,13 @@ struct pj_datum_find_nadgrids_static {} }; -template -inline bool pj_datum_find_nadgrids(srs::spar::parameters const& params, +template +inline bool pj_datum_find_nadgrids(srs::spar::parameters const& params, srs::detail::nadgrids & out) { pj_datum_find_nadgrids_static < - srs::spar::parameters + srs::spar::parameters >::apply(params, out); return ! out.empty(); @@ -314,15 +314,15 @@ template Params, srs::spar::detail::is_param_t::pred >::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_datum_find_towgs84_static { template static void apply(Params const& params, srs::detail::towgs84 & out) { - typename boost::tuples::element::type const& - towgs84 = boost::tuples::get(params); + typename geometry::tuples::element::type const& + towgs84 = geometry::tuples::get(params); std::size_t n = (std::min)(towgs84.size(), 7u); std::size_t z = n <= 3 ? 3 : 7; @@ -345,13 +345,13 @@ struct pj_datum_find_towgs84_static {} }; -template -inline bool pj_datum_find_towgs84(srs::spar::parameters const& params, +template +inline bool pj_datum_find_towgs84(srs::spar::parameters const& params, srs::detail::towgs84 & out) { pj_datum_find_towgs84_static < - srs::spar::parameters + srs::spar::parameters >::apply(params, out); return ! out.empty(); diff --git a/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp b/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp index ea52dfdbc..18b4aa116 100644 --- a/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp @@ -168,18 +168,18 @@ template Params, srs::spar::detail::is_param_tr::pred >::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_ell_init_ellps_static { template static bool apply(Params const& params, T &a, T &b) { - typedef typename boost::tuples::element::type param_type; + typedef typename geometry::tuples::element::type param_type; typedef srs::spar::detail::ellps_traits traits_type; typedef typename traits_type::template model_type::type model_type; - param_type const& param = boost::tuples::get(params); + param_type const& param = geometry::tuples::get(params); model_type const& model = traits_type::template model(param); a = geometry::get_radius<0>(model); @@ -198,13 +198,13 @@ struct pj_ell_init_ellps_static } }; -template -inline bool pj_ell_init_ellps(srs::spar::parameters const& params, +template +inline bool pj_ell_init_ellps(srs::spar::parameters const& params, T &a, T &b) { return pj_ell_init_ellps_static < - srs::spar::parameters + srs::spar::parameters >::apply(params, a, b); } diff --git a/include/boost/geometry/srs/projections/impl/pj_init.hpp b/include/boost/geometry/srs/projections/impl/pj_init.hpp index f998be55b..9f8119e4f 100644 --- a/include/boost/geometry/srs/projections/impl/pj_init.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_init.hpp @@ -93,11 +93,11 @@ inline void pj_init_proj(srs::dpar::parameters const& params, } } -template -inline void pj_init_proj(srs::spar::parameters const& , +template +inline void pj_init_proj(srs::spar::parameters const& , parameters & par) { - typedef srs::spar::parameters params_type; + typedef srs::spar::parameters params_type; typedef typename geometry::tuples::find_if < params_type, @@ -247,7 +247,7 @@ template srs::spar::detail::is_param_t >::template pred >::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_init_units_static : pj_init_units_static @@ -259,7 +259,7 @@ struct pj_init_units_static static const int n = sizeof(pj_units) / sizeof(pj_units[0]); static const int i = srs::spar::detail::units_traits < - typename boost::tuples::element::type + typename geometry::tuples::element::type >::id; static const bool is_valid = i >= 0 && i < n; @@ -289,7 +289,7 @@ struct pj_init_units_static T & to_meter, T & fr_meter, T const& , T const& ) { - to_meter = boost::tuples::get(params).value; + to_meter = geometry::tuples::get(params).value; fr_meter = 1. / to_meter; } }; @@ -307,8 +307,8 @@ struct pj_init_units_static } }; -template -inline void pj_init_units(srs::spar::parameters const& params, +template +inline void pj_init_units(srs::spar::parameters const& params, T & to_meter, T & fr_meter, T const& default_to_meter, @@ -316,7 +316,7 @@ inline void pj_init_units(srs::spar::parameters, + srs::spar::parameters, Vertical >::apply(params, to_meter, fr_meter, default_to_meter, default_fr_meter); } @@ -396,16 +396,16 @@ template Params, srs::spar::detail::is_param_tr::pred >::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_init_pm_static { template static void apply(Params const& params, T & val) { - typedef typename boost::tuples::element::type param_type; + typedef typename geometry::tuples::element::type param_type; - val = srs::spar::detail::pm_traits::value(boost::tuples::get(params)); + val = srs::spar::detail::pm_traits::value(geometry::tuples::get(params)); } }; template @@ -418,12 +418,12 @@ struct pj_init_pm_static } }; -template -inline void pj_init_pm(srs::spar::parameters const& params, T& val) +template +inline void pj_init_pm(srs::spar::parameters const& params, T& val) { pj_init_pm_static < - srs::spar::parameters + srs::spar::parameters >::apply(params, val); } diff --git a/include/boost/geometry/srs/projections/impl/pj_param.hpp b/include/boost/geometry/srs/projections/impl/pj_param.hpp index 286543a63..283a65967 100644 --- a/include/boost/geometry/srs/projections/impl/pj_param.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_param.hpp @@ -105,11 +105,11 @@ template typename StaticParams, typename IsParamPred, int I = tuples_find_index_if::value, - int N = boost::tuples::length::value + int N = geometry::tuples::size::value > struct pj_param_find_static { - typedef boost::tuples::element type; + typedef geometry::tuples::element type; typedef const type* result_type; static result_type get(StaticParams const& params) { @@ -133,27 +133,27 @@ inline bool pj_param_exists(Params const& params, Name const& name) return pj_param_find(params, name) != params.end(); } -template -inline bool pj_param_exists(srs::spar::parameters const& ) +template +inline bool pj_param_exists(srs::spar::parameters const& ) { return geometry::tuples::is_found < typename geometry::tuples::find_if < - srs::spar::parameters, + srs::spar::parameters, srs::spar::detail::is_param::template pred >::type >::value; } -template