Replace boost::tuple with std::tuple or custom classes.

Modernize tuple support.
This commit is contained in:
Adam Wulkiewicz 2020-09-11 18:37:02 +02:00
parent 4c1a7f8f3d
commit 3402c9101d
25 changed files with 721 additions and 1102 deletions

View File

@ -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 )
{

View File

@ -18,9 +18,7 @@
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>
@ -248,13 +246,9 @@ public:
TurnPoint,
geometry::segment_ratio<boost::long_long_type>
> 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<UniqueSubRange1, UniqueSubRange2,
public:
typedef segment_intersection_points<TurnPoint> 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
{

View File

@ -14,8 +14,7 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_DE9IM_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_DE9IM_HPP
#include <boost/static_assert.hpp>
#include <boost/tuple/tuple.hpp>
#include <tuple>
#include <boost/geometry/algorithms/detail/relate/result.hpp>
#include <boost/geometry/core/topological_dimension.hpp>
@ -153,33 +152,20 @@ class static_mask
inline
boost::tuples::cons
<
mask,
boost::tuples::cons<mask, boost::tuples::null_type>
>
std::tuple<mask, mask>
operator||(mask const& m1, mask const& m2)
{
namespace bt = boost::tuples;
return bt::cons<mask, bt::cons<mask, bt::null_type> >
( m1, bt::cons<mask, bt::null_type>(m2, bt::null_type()) );
return std::tuple<mask, mask>(m1, m2);
}
template <typename Tail>
template <typename ...Masks>
inline
typename geometry::tuples::push_back
<
boost::tuples::cons<mask, Tail>,
mask
>::type
operator||(boost::tuples::cons<mask, Tail> const& t, mask const& m)
std::tuple<Masks..., mask>
operator||(std::tuple<Masks...> const& t, mask const& m)
{
namespace bt = boost::tuples;
return geometry::tuples::push_back
<
bt::cons<mask, Tail>,
std::tuple<Masks...>,
mask
>::apply(t, m);
}

View File

@ -15,7 +15,8 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_INTERFACE_HPP
#include <boost/tuple/tuple.hpp>
#include <tuple>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant_fwd.hpp>
@ -104,12 +105,12 @@ struct result_handler_type<Geometry1, Geometry2, geometry::de9im::mask>
> type;
};
template <typename Geometry1, typename Geometry2, typename Head, typename Tail>
struct result_handler_type<Geometry1, Geometry2, boost::tuples::cons<Head, Tail>>
template <typename Geometry1, typename Geometry2, typename ...Masks>
struct result_handler_type<Geometry1, Geometry2, std::tuple<Masks...>>
{
typedef mask_handler
<
boost::tuples::cons<Head, Tail>,
std::tuple<Masks...>,
interruption_enabled
<
Geometry1,

View File

@ -308,14 +308,14 @@ struct interrupt_dispatch<Mask, true>
}
};
template <typename Masks, int I = 0, int N = boost::tuples::length<Masks>::value>
template <typename Masks, int I = 0, int N = std::tuple_size<Masks>::value>
struct interrupt_dispatch_tuple
{
template <field F1, field F2, char V>
static inline bool apply(Masks const& masks)
{
typedef typename boost::tuples::element<I, Masks>::type mask_type;
mask_type const& mask = boost::get<I>(masks);
typedef typename std::tuple_element<I, Masks>::type mask_type;
mask_type const& mask = std::get<I>(masks);
return interrupt_dispatch<mask_type, true>::template apply<F1, F2, V>(mask)
&& interrupt_dispatch_tuple<Masks, I+1>::template apply<F1, F2, V>(masks);
}
@ -331,23 +331,10 @@ struct interrupt_dispatch_tuple<Masks, N, N>
}
};
//template <typename T0, typename T1, typename T2, typename T3, typename T4,
// typename T5, typename T6, typename T7, typename T8, typename T9>
//struct interrupt_dispatch<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, true>
//{
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> mask_type;
// template <field F1, field F2, char V>
// static inline bool apply(mask_type const& mask)
// {
// return interrupt_dispatch_tuple<mask_type>::template apply<F1, F2, V>(mask);
// }
//};
template <typename Head, typename Tail>
struct interrupt_dispatch<boost::tuples::cons<Head, Tail>, true>
template <typename ...Masks>
struct interrupt_dispatch<std::tuple<Masks...>, true>
{
typedef boost::tuples::cons<Head, Tail> mask_type;
typedef std::tuple<Masks...> mask_type;
template <field F1, field F2, char V>
static inline bool apply(mask_type const& mask)
@ -394,14 +381,14 @@ struct may_update_dispatch
}
};
template <typename Masks, int I = 0, int N = boost::tuples::length<Masks>::value>
template <typename Masks, int I = 0, int N = std::tuple_size<Masks>::value>
struct may_update_dispatch_tuple
{
template <field F1, field F2, char D, typename Matrix>
static inline bool apply(Masks const& masks, Matrix const& matrix)
{
typedef typename boost::tuples::element<I, Masks>::type mask_type;
mask_type const& mask = boost::get<I>(masks);
typedef typename std::tuple_element<I, Masks>::type mask_type;
mask_type const& mask = std::get<I>(masks);
return may_update_dispatch<mask_type>::template apply<F1, F2, D>(mask, matrix)
|| may_update_dispatch_tuple<Masks, I+1>::template apply<F1, F2, D>(masks, matrix);
}
@ -417,23 +404,10 @@ struct may_update_dispatch_tuple<Masks, N, N>
}
};
//template <typename T0, typename T1, typename T2, typename T3, typename T4,
// typename T5, typename T6, typename T7, typename T8, typename T9>
//struct may_update_dispatch< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> mask_type;
// template <field F1, field F2, char D, typename Matrix>
// static inline bool apply(mask_type const& mask, Matrix const& matrix)
// {
// return may_update_dispatch_tuple<mask_type>::template apply<F1, F2, D>(mask, matrix);
// }
//};
template <typename Head, typename Tail>
struct may_update_dispatch< boost::tuples::cons<Head, Tail> >
template <typename ...Masks>
struct may_update_dispatch<std::tuple<Masks...>>
{
typedef boost::tuples::cons<Head, Tail> mask_type;
typedef std::tuple<Masks...> mask_type;
template <field F1, field F2, char D, typename Matrix>
static inline bool apply(mask_type const& mask, Matrix const& matrix)
@ -491,14 +465,14 @@ struct check_dispatch
}
};
template <typename Masks, int I = 0, int N = boost::tuples::length<Masks>::value>
template <typename Masks, int I = 0, int N = std::tuple_size<Masks>::value>
struct check_dispatch_tuple
{
template <typename Matrix>
static inline bool apply(Masks const& masks, Matrix const& matrix)
{
typedef typename boost::tuples::element<I, Masks>::type mask_type;
mask_type const& mask = boost::get<I>(masks);
typedef typename std::tuple_element<I, Masks>::type mask_type;
mask_type const& mask = std::get<I>(masks);
return check_dispatch<mask_type>::apply(mask, matrix)
|| check_dispatch_tuple<Masks, I+1>::apply(masks, matrix);
}
@ -514,23 +488,10 @@ struct check_dispatch_tuple<Masks, N, N>
}
};
//template <typename T0, typename T1, typename T2, typename T3, typename T4,
// typename T5, typename T6, typename T7, typename T8, typename T9>
//struct check_dispatch< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> mask_type;
// template <typename Matrix>
// static inline bool apply(mask_type const& mask, Matrix const& matrix)
// {
// return check_dispatch_tuple<mask_type>::apply(mask, matrix);
// }
//};
template <typename Head, typename Tail>
struct check_dispatch< boost::tuples::cons<Head, Tail> >
template <typename ...Masks>
struct check_dispatch<std::tuple<Masks...>>
{
typedef boost::tuples::cons<Head, Tail> mask_type;
typedef std::tuple<Masks...> mask_type;
template <typename Matrix>
static inline bool apply(mask_type const& mask, Matrix const& matrix)
@ -555,11 +516,11 @@ struct matrix_width
template <typename Tuple,
int I = 0,
int N = boost::tuples::length<Tuple>::value>
int N = std::tuple_size<Tuple>::value>
struct matrix_width_tuple
{
static const std::size_t
current = matrix_width<typename boost::tuples::element<I, Tuple>::type>::value;
current = matrix_width<typename std::tuple_element<I, Tuple>::type>::value;
static const std::size_t
next = matrix_width_tuple<Tuple, I+1>::value;
@ -573,11 +534,11 @@ struct matrix_width_tuple<Tuple, N, N>
static const std::size_t value = 0;
};
template <typename Head, typename Tail>
struct matrix_width< boost::tuples::cons<Head, Tail> >
template <typename ...Masks>
struct matrix_width<std::tuple<Masks...>>
{
static const std::size_t
value = matrix_width_tuple< boost::tuples::cons<Head, Tail> >::value;
value = matrix_width_tuple<std::tuple<Masks...>>::value;
};
// mask_handler

View File

@ -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 <typename T>
struct is_tupled
: util::bool_constant<false>
{};
template
<
class T0, class T1, class T2, class T3, class T4,
class T5, class T6, class T7, class T8, class T9
>
struct is_tupled<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
: util::bool_constant<true>
{};
template <typename HT, typename TT>
struct is_tupled<boost::tuples::cons<HT, TT> >
: util::bool_constant<true>
{};
template <typename F, typename S>
struct is_tupled<std::pair<F, S> >
: util::bool_constant<true>
{};
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <typename ...Ts>
struct is_tupled<std::tuple<Ts...> >
: util::bool_constant<true>
{};
#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 <typename Output, bool IsTupled = is_tupled<Output>::value>
template <typename Output, bool IsTupled = tuples::is_tuple<Output>::value>
struct is_tupled_output
: util::bool_constant<false>
{};
@ -137,7 +102,7 @@ struct is_tupled_output<Output, true>
// true if T is boost::tuple, boost::tuples::cons, std::pair or std::tuple
// and is_tupled_single_output_check defiend above passes
template <typename T, bool IsTupled = is_tupled<T>::value>
template <typename T, bool IsTupled = tuples::is_tuple<T>::value>
struct is_tupled_single_output
: util::bool_constant<false>
{};
@ -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<Tuple>::value
>
struct tupled_range_values_bt
{
typedef boost::tuples::cons
<
typename boost::range_value
<
typename geometry::tuples::element<I, Tuple>::type
>::type,
typename tupled_range_values_bt<Tuple, I+1, N>::type
> type;
};
template <typename Tuple>
struct tupled_range_values;
template <typename Tuple, size_t N>
struct tupled_range_values_bt<Tuple, N, N>
template <typename ...Ts>
struct tupled_range_values<std::tuple<Ts...> >
{
typedef boost::tuples::null_type type;
typedef std::tuple<typename boost::range_value<Ts>::type...> type;
};
template <typename Output>
struct tupled_range_values
: tupled_range_values_bt<Output>
{};
template <typename F, typename S>
struct tupled_range_values<std::pair<F, S> >
{
@ -243,74 +188,46 @@ struct tupled_range_values<std::pair<F, S> >
> type;
};
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <typename ...Ts>
struct tupled_range_values<std::tuple<Ts...> >
template
<
typename Tuple,
size_t I = 0,
size_t N = boost::tuples::length<Tuple>::value
>
struct tupled_range_values_bt
{
typedef std::tuple<typename boost::range_value<Ts>::type...> type;
typedef boost::tuples::cons
<
typename boost::range_value
<
typename boost::tuples::element<I, Tuple>::type
>::type,
typename tupled_range_values_bt<Tuple, I+1, N>::type
> type;
};
#endif // BOOST_GEOMETRY_CXX11_TUPLE
template <typename Tuple, size_t N>
struct tupled_range_values_bt<Tuple, N, N>
{
typedef boost::tuples::null_type type;
};
template <typename ...Ts>
struct tupled_range_values<boost::tuples::tuple<Ts...>>
: tupled_range_values_bt<boost::tuples::tuple<Ts...>>
{};
template <typename HT, typename TT>
struct tupled_range_values<boost::tuples::cons<HT, TT>>
: tupled_range_values_bt<boost::tuples::cons<HT, TT>>
{};
// util defining a type and creating a tuple holding back-insert-iterators to
// ranges being elements of Output pair/tuple
template <typename Tuple,
size_t I = 0,
size_t N = geometry::tuples::size<Tuple>::value>
struct tupled_back_inserters_bt
{
typedef boost::tuples::cons
<
geometry::range::back_insert_iterator
<
typename geometry::tuples::element<I, Tuple>::type
>,
typename tupled_back_inserters_bt<Tuple, I+1, N>::type
> type;
static type apply(Tuple & tup)
{
return type(geometry::range::back_inserter(geometry::tuples::get<I>(tup)),
tupled_back_inserters_bt<Tuple, I+1, N>::apply(tup));
}
};
template <typename Tuple, size_t N>
struct tupled_back_inserters_bt<Tuple, N, N>
{
typedef boost::tuples::null_type type;
static type apply(Tuple const&)
{
return type();
}
};
template <typename Tuple>
struct tupled_back_inserters
: tupled_back_inserters_bt<Tuple>
{};
template <typename F, typename S>
struct tupled_back_inserters<std::pair<F, S> >
{
typedef std::pair
<
geometry::range::back_insert_iterator<F>,
geometry::range::back_insert_iterator<S>
> type;
static type apply(std::pair<F, S> & 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 <typename Is, typename Tuple>
struct tupled_back_inserters_st;
@ -335,7 +252,63 @@ struct tupled_back_inserters<std::tuple<Ts...> >
>
{};
#endif // BOOST_GEOMETRY_CXX11_TUPLE
template <typename F, typename S>
struct tupled_back_inserters<std::pair<F, S> >
{
typedef std::pair
<
geometry::range::back_insert_iterator<F>,
geometry::range::back_insert_iterator<S>
> type;
static type apply(std::pair<F, S> & p)
{
return type(geometry::range::back_inserter(p.first),
geometry::range::back_inserter(p.second));
}
};
template <typename Tuple,
size_t I = 0,
size_t N = boost::tuples::length<Tuple>::value>
struct tupled_back_inserters_bt
{
typedef boost::tuples::cons
<
geometry::range::back_insert_iterator
<
typename boost::tuples::element<I, Tuple>::type
>,
typename tupled_back_inserters_bt<Tuple, I+1, N>::type
> type;
static type apply(Tuple & tup)
{
return type(geometry::range::back_inserter(boost::get<I>(tup)),
tupled_back_inserters_bt<Tuple, I+1, N>::apply(tup));
}
};
template <typename Tuple, size_t N>
struct tupled_back_inserters_bt<Tuple, N, N>
{
typedef boost::tuples::null_type type;
static type apply(Tuple const&)
{
return type();
}
};
template <typename ...Ts>
struct tupled_back_inserters<boost::tuples::tuple<Ts...>>
: tupled_back_inserters_bt<boost::tuples::tuple<Ts...>>
{};
template <typename HT, typename TT>
struct tupled_back_inserters<boost::tuples::cons<HT, TT>>
: tupled_back_inserters_bt<boost::tuples::cons<HT, TT>>
{};
template
@ -476,13 +449,14 @@ struct output_geometry_concept_check_t<Tuple, N, N>
{}
};
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<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
: output_geometry_concept_check_t<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
template <typename ...Ts>
struct output_geometry_concept_check<std::tuple<Ts...> >
: output_geometry_concept_check_t<std::tuple<Ts...> >
{};
template <typename ...Ts>
struct output_geometry_concept_check<boost::tuple<Ts...> >
: output_geometry_concept_check_t<boost::tuple<Ts...> >
{};
template <typename HT, typename TT>
@ -490,15 +464,6 @@ struct output_geometry_concept_check<boost::tuples::cons<HT, TT> >
: output_geometry_concept_check_t<boost::tuples::cons<HT, TT> >
{};
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <typename ...Ts>
struct output_geometry_concept_check<std::tuple<Ts...> >
: output_geometry_concept_check_t<std::tuple<Ts...> >
{};
#endif // BOOST_GEOMETRY_CXX11_TUPLE
struct tupled_output_tag {};
@ -569,33 +534,10 @@ struct expect_output_assert<Geometry1, Geometry2, TupledOut, void>
template
<
typename Geometry1, typename Geometry2, typename TupledOut,
typename Tag1,
typename Tag2 = void,
typename Tag3 = void
typename ...Tags
>
struct expect_output
: expect_output_assert<Geometry1, Geometry2, TupledOut, Tag1>
, expect_output_assert<Geometry1, Geometry2, TupledOut, Tag2>
, expect_output_assert<Geometry1, Geometry2, TupledOut, Tag3>
{};
template
<
typename Geometry1, typename Geometry2, typename TupledOut,
typename Tag1, typename Tag2
>
struct expect_output<Geometry1, Geometry2, TupledOut, Tag1, Tag2, void>
: expect_output_assert<Geometry1, Geometry2, TupledOut, Tag1>
, expect_output_assert<Geometry1, Geometry2, TupledOut, Tag2>
{};
template
<
typename Geometry1, typename Geometry2, typename TupledOut,
typename Tag1
>
struct expect_output<Geometry1, Geometry2, TupledOut, Tag1, void, void>
: expect_output_assert<Geometry1, Geometry2, TupledOut, Tag1>
: expect_output_assert<Geometry1, Geometry2, TupledOut, Tags>...
{};

View File

@ -15,11 +15,10 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_PREDICATES_HPP
#include <tuple>
#include <type_traits>
//#include <utility>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/index/detail/tags.hpp>
@ -524,22 +523,10 @@ struct predicates_length
static const unsigned value = 1;
};
//template <typename F, typename S>
//struct predicates_length< std::pair<F, S> >
//{
// static const unsigned value = 2;
//};
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
//struct predicates_length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// static const unsigned value = boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value;
//};
template <typename Head, typename Tail>
struct predicates_length< boost::tuples::cons<Head, Tail> >
template <typename ...Ts>
struct predicates_length<std::tuple<Ts...>>
{
static const unsigned value = boost::tuples::length< boost::tuples::cons<Head, Tail> >::value;
static const unsigned value = std::tuple_size<std::tuple<Ts...>>::value;
};
// ------------------------------------------------------------------ //
@ -557,88 +544,19 @@ struct predicates_element
static type const& get(T const& p) { return p; }
};
//template <unsigned I, typename F, typename S>
//struct predicates_element< I, std::pair<F, S> >
//{
// BOOST_GEOMETRY_STATIC_ASSERT((I < 2), "INVALID_INDEX", std::integral_constant<unsigned, I>, F, S);
//
// typedef F type;
// static type const& get(std::pair<F, S> const& p) { return p.first; }
//};
//
//template <typename F, typename S>
//struct predicates_element< 1, std::pair<F, S> >
//{
// typedef S type;
// static type const& get(std::pair<F, S> const& p) { return p.second; }
//};
//
//template <unsigned I, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
//struct predicates_element< I, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicate_type;
//
// typedef typename boost::tuples::element<I, predicate_type>::type type;
// static type const& get(predicate_type const& p) { return boost::get<I>(p); }
//};
template <unsigned I, typename Head, typename Tail>
struct predicates_element< I, boost::tuples::cons<Head, Tail> >
template <unsigned I, typename ...Ts>
struct predicates_element<I, std::tuple<Ts...>>
{
typedef boost::tuples::cons<Head, Tail> predicate_type;
typedef std::tuple<Ts...> predicate_type;
typedef typename boost::tuples::element<I, predicate_type>::type type;
static type const& get(predicate_type const& p) { return boost::get<I>(p); }
typedef typename std::tuple_element<I, predicate_type>::type type;
static type const& get(predicate_type const& p) { return std::get<I>(p); }
};
// ------------------------------------------------------------------ //
// predicates_check
// ------------------------------------------------------------------ //
//template <typename PairPredicates, typename Tag, unsigned First, unsigned Last>
//struct predicates_check_pair {};
//
//template <typename PairPredicates, typename Tag, unsigned I>
//struct predicates_check_pair<PairPredicates, Tag, I, I>
//{
// template <typename Value, typename Indexable>
// static inline bool apply(PairPredicates const& , Value const& , Indexable const& )
// {
// return true;
// }
//};
//
//template <typename PairPredicates, typename Tag>
//struct predicates_check_pair<PairPredicates, Tag, 0, 1>
//{
// template <typename Value, typename Indexable>
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
// {
// return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i);
// }
//};
//
//template <typename PairPredicates, typename Tag>
//struct predicates_check_pair<PairPredicates, Tag, 1, 2>
//{
// template <typename Value, typename Indexable>
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
// {
// return predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
// }
//};
//
//template <typename PairPredicates, typename Tag>
//struct predicates_check_pair<PairPredicates, Tag, 0, 2>
//{
// template <typename Value, typename Indexable>
// static inline bool apply(PairPredicates const& p, Value const& v, Indexable const& i)
// {
// return predicate_check<typename PairPredicates::first_type, Tag>::apply(p.first, v, i)
// && predicate_check<typename PairPredicates::second_type, Tag>::apply(p.second, v, i);
// }
//};
template <typename TuplePredicates, typename Tag, unsigned First, unsigned Last>
struct predicates_check_tuple
{
@ -647,9 +565,9 @@ struct predicates_check_tuple
{
return predicate_check
<
typename boost::tuples::element<First, TuplePredicates>::type,
typename std::tuple_element<First, TuplePredicates>::type,
Tag
>::apply(boost::get<First>(p), v, i, s)
>::apply(std::get<First>(p), v, i, s)
&& predicates_check_tuple<TuplePredicates, Tag, First+1, Last>::apply(p, v, i, s);
}
};
@ -679,57 +597,12 @@ struct predicates_check_impl
}
};
//template <typename Predicate1, typename Predicate2, typename Tag, size_t First, size_t Last>
//struct predicates_check_impl<std::pair<Predicate1, Predicate2>, Tag, First, Last>
//{
// BOOST_GEOMETRY_STATIC_ASSERT((First < 2 && Last <= 2 && First <= Last),
// "INVALID_INDEXES",
// std::integer_sequence<unsigned, First, Last>);
//
// template <typename Value, typename Indexable>
// static inline bool apply(std::pair<Predicate1, Predicate2> const& p, Value const& v, Indexable const& i)
// {
// return predicate_check<Predicate1, Tag>::apply(p.first, v, i)
// && predicate_check<Predicate2, Tag>::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<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
// Tag, First, Last
//>
//{
// typedef boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> predicates_type;
//
// static const unsigned pred_len = boost::tuples::length<predicates_type>::value;
// BOOST_GEOMETRY_STATIC_ASSERT((First < pred_len && Last <= pred_len && First <= Last),
// "INVALID_INDEXES",
// std::integer_sequence<unsigned, First, Last>);
//
// template <typename Value, typename Indexable>
// 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 <typename Head, typename Tail, typename Tag, unsigned First, unsigned Last>
struct predicates_check_impl<
boost::tuples::cons<Head, Tail>,
Tag, First, Last
>
template <typename ...Ts, typename Tag, unsigned First, unsigned Last>
struct predicates_check_impl<std::tuple<Ts...>, Tag, First, Last>
{
typedef boost::tuples::cons<Head, Tail> predicates_type;
typedef std::tuple<Ts...> predicates_type;
static const unsigned pred_len = boost::tuples::length<predicates_type>::value;
static const unsigned pred_len = std::tuple_size<predicates_type>::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 <typename Value, typename Indexable, typename Strategy>
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<T>::value;
};
//template <typename F, typename S>
//struct predicates_count_distance< std::pair<F, S> >
//{
// static const unsigned value = predicates_is_distance<F>::value
// + predicates_is_distance<S>::value;
//};
template <typename Tuple, unsigned N>
struct predicates_count_distance_tuple
{
static const unsigned value =
predicates_is_distance<typename boost::tuples::element<N-1, Tuple>::type>::value
predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value
+ predicates_count_distance_tuple<Tuple, N-1>::value;
};
@ -803,24 +670,15 @@ template <typename Tuple>
struct predicates_count_distance_tuple<Tuple, 1>
{
static const unsigned value =
predicates_is_distance<typename boost::tuples::element<0, Tuple>::type>::value;
predicates_is_distance<typename std::tuple_element<0, Tuple>::type>::value;
};
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
//struct predicates_count_distance< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// static const unsigned value = predicates_count_distance_tuple<
// boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
// boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
// >::value;
//};
template <typename Head, typename Tail>
struct predicates_count_distance< boost::tuples::cons<Head, Tail> >
template <typename ...Ts>
struct predicates_count_distance<std::tuple<Ts...>>
{
static const unsigned value = predicates_count_distance_tuple<
boost::tuples::cons<Head, Tail>,
boost::tuples::length< boost::tuples::cons<Head, Tail> >::value
std::tuple<Ts...>,
std::tuple_size<std::tuple<Ts...>>::value
>::value;
};
@ -832,47 +690,31 @@ struct predicates_find_distance
static const unsigned value = predicates_is_distance<T>::value ? 0 : 1;
};
//template <typename F, typename S>
//struct predicates_find_distance< std::pair<F, S> >
//{
// static const unsigned value = predicates_is_distance<F>::value ? 0 :
// (predicates_is_distance<S>::value ? 1 : 2);
//};
template <typename Tuple, unsigned N>
struct predicates_find_distance_tuple
{
static const bool is_found = predicates_find_distance_tuple<Tuple, N-1>::is_found
|| predicates_is_distance<typename boost::tuples::element<N-1, Tuple>::type>::value;
|| predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value;
static const unsigned value = predicates_find_distance_tuple<Tuple, N-1>::is_found ?
predicates_find_distance_tuple<Tuple, N-1>::value :
(predicates_is_distance<typename boost::tuples::element<N-1, Tuple>::type>::value ?
N-1 : boost::tuples::length<Tuple>::value);
(predicates_is_distance<typename std::tuple_element<N-1, Tuple>::type>::value ?
N-1 : std::tuple_size<Tuple>::value);
};
template <typename Tuple>
struct predicates_find_distance_tuple<Tuple, 1>
{
static const bool is_found = predicates_is_distance<typename boost::tuples::element<0, Tuple>::type>::value;
static const unsigned value = is_found ? 0 : boost::tuples::length<Tuple>::value;
static const bool is_found = predicates_is_distance<typename std::tuple_element<0, Tuple>::type>::value;
static const unsigned value = is_found ? 0 : std::tuple_size<Tuple>::value;
};
//template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
//struct predicates_find_distance< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
//{
// static const unsigned value = predicates_find_distance_tuple<
// boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>,
// boost::tuples::length< boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::value
// >::value;
//};
template <typename Head, typename Tail>
struct predicates_find_distance< boost::tuples::cons<Head, Tail> >
template <typename ...Ts>
struct predicates_find_distance<std::tuple<Ts...>>
{
static const unsigned value = predicates_find_distance_tuple<
boost::tuples::cons<Head, Tail>,
boost::tuples::length< boost::tuples::cons<Head, Tail> >::value
std::tuple<Ts...>,
std::tuple_size<std::tuple<Ts...>>::value
>::value;
};

View File

@ -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 <algorithm>
#include <boost/tuple/tuple.hpp>
#include <tuple>
namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace utilities {
@ -87,7 +87,7 @@ struct statistics
} // namespace visitors
template <typename Rtree> inline
boost::tuple<std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t>
std::tuple<std::size_t, std::size_t, std::size_t, std::size_t, std::size_t, std::size_t>
statistics(Rtree const& tree)
{
typedef utilities::view<Rtree> 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

View File

@ -396,34 +396,26 @@ operator!(spatial_predicate<Geometry, Tag, Negated> const& p)
// operator&& generators
template <typename Pred1, typename Pred2> inline
boost::tuples::cons<
Pred1,
boost::tuples::cons<Pred2, boost::tuples::null_type>
>
std::tuple<Pred1, Pred2>
operator&&(Pred1 const& p1, Pred2 const& p2)
{
/*typedef std::conditional_t<is_predicate<Pred1>::value, Pred1, Pred1 const&> stored1;
typedef std::conditional_t<is_predicate<Pred2>::value, Pred2, Pred2 const&> stored2;*/
namespace bt = boost::tuples;
return
bt::cons< Pred1, bt::cons<Pred2, bt::null_type> >
( p1, bt::cons<Pred2, bt::null_type>(p2, bt::null_type()) );
return std::tuple<Pred1, Pred2>(p1, p2);
}
template <typename Head, typename Tail, typename Pred> inline
typename geometry::tuples::push_back<
boost::tuples::cons<Head, Tail>, Pred
>::type
operator&&(boost::tuples::cons<Head, Tail> const& t, Pred const& p)
template <typename ...Preds, typename Pred> inline
typename geometry::tuples::push_back
<
std::tuple<Preds...>, Pred
>::type
operator&&(std::tuple<Preds...> const& t, Pred const& p)
{
//typedef std::conditional_t<is_predicate<Pred>::value, Pred, Pred const&> stored;
namespace bt = boost::tuples;
return
geometry::tuples::push_back<
bt::cons<Head, Tail>, Pred
>::apply(t, p);
return geometry::tuples::push_back
<
std::tuple<Preds...>, Pred
>::apply(t, p);
}
}} // namespace detail::predicates

View File

@ -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 <tt>boost::geometry::index::linear</tt>,
\li <tt>boost::geometry::index::linear</tt>,
\li <tt>boost::geometry::index::quadratic</tt>,
\li <tt>boost::geometry::index::rstar</tt>.
@ -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 <tt>std::pair<Indexable, T></tt>, <tt>boost::tuple<Indexable, ...></tt>
and <tt>std::tuple<Indexable, ...></tt> when possible. For example, for Value
handle <tt>std::pair<Indexable, T></tt>, <tt>std::tuple<Indexable, ...></tt>
and <tt>boost::tuple<Indexable, ...></tt>. For example, for Value
of type <tt>std::pair<Box, int></tt>, the default IndexableGetter translates
from <tt>std::pair<Box, int> const&</tt> to <tt>Box const&</tt>.

View File

@ -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 <string>
#include <tuple>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/strategies/side_info.hpp>
namespace boost { namespace geometry
{
namespace policies { namespace relate
{
template <typename IntersectionPointsReturnType>
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 <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
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 <typename Segment1, typename Segment2, typename Ratio>
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 <typename Segment>
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 <typename Segment, typename Ratio>
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

View File

@ -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 <string>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry/strategies/side_info.hpp>
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 <typename Policy1, typename Policy2>
struct segments_tupled
{
typedef boost::tuple
<
typename Policy1::return_type,
typename Policy2::return_type
> return_type;
template <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
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 <typename Segment1, typename Segment2, typename Ratio>
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 <typename Segment>
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 <typename Segment, typename Ratio>
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

View File

@ -416,11 +416,11 @@ private:
projection_type m_proj;
};
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename CT>
class proj_wrapper<srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>, CT>
: public static_proj_wrapper_base<srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>, CT>
template <typename ...Ps, typename CT>
class proj_wrapper<srs::spar::parameters<Ps...>, CT>
: public static_proj_wrapper_base<srs::spar::parameters<Ps...>, CT>
{
typedef srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
typedef srs::spar::parameters<Ps...>
static_parameters_type;
typedef static_proj_wrapper_base
<

View File

@ -161,12 +161,12 @@ struct pj_datum_find_datum_static<Params, Param, false>
}
};
template <typename T, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline const pj_datums_type<T>* pj_datum_find_datum(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params)
template <typename T, typename ...Ps>
inline const pj_datums_type<T>* pj_datum_find_datum(srs::spar::parameters<Ps...> const& params)
{
return pj_datum_find_datum_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
srs::spar::parameters<Ps...>
>::template apply<T>(params);
}
@ -219,13 +219,13 @@ template
Params,
srs::spar::detail::is_param<srs::spar::nadgrids>::pred
>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct pj_datum_find_nadgrids_static
{
static void apply(Params const& params, srs::detail::nadgrids & out)
{
out = boost::tuples::get<I>(params);
out = geometry::tuples::get<I>(params);
}
};
template <typename Params, int N>
@ -235,13 +235,13 @@ struct pj_datum_find_nadgrids_static<Params, N, N>
{}
};
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_datum_find_nadgrids(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params,
template <typename ...Ps>
inline bool pj_datum_find_nadgrids(srs::spar::parameters<Ps...> const& params,
srs::detail::nadgrids & out)
{
pj_datum_find_nadgrids_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
srs::spar::parameters<Ps...>
>::apply(params, out);
return ! out.empty();
@ -314,15 +314,15 @@ template
Params,
srs::spar::detail::is_param_t<srs::spar::towgs84>::pred
>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct pj_datum_find_towgs84_static
{
template <typename T>
static void apply(Params const& params, srs::detail::towgs84<T> & out)
{
typename boost::tuples::element<I, Params>::type const&
towgs84 = boost::tuples::get<I>(params);
typename geometry::tuples::element<I, Params>::type const&
towgs84 = geometry::tuples::get<I>(params);
std::size_t n = (std::min<std::size_t>)(towgs84.size(), 7u);
std::size_t z = n <= 3 ? 3 : 7;
@ -345,13 +345,13 @@ struct pj_datum_find_towgs84_static<Params, N, N>
{}
};
template <typename T, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_datum_find_towgs84(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params,
template <typename T, typename ...Ps>
inline bool pj_datum_find_towgs84(srs::spar::parameters<Ps...> const& params,
srs::detail::towgs84<T> & out)
{
pj_datum_find_towgs84_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
srs::spar::parameters<Ps...>
>::apply(params, out);
return ! out.empty();

View File

@ -168,18 +168,18 @@ template
Params,
srs::spar::detail::is_param_tr<srs::spar::detail::ellps_traits>::pred
>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct pj_ell_init_ellps_static
{
template <typename T>
static bool apply(Params const& params, T &a, T &b)
{
typedef typename boost::tuples::element<I, Params>::type param_type;
typedef typename geometry::tuples::element<I, Params>::type param_type;
typedef srs::spar::detail::ellps_traits<param_type> traits_type;
typedef typename traits_type::template model_type<T>::type model_type;
param_type const& param = boost::tuples::get<I>(params);
param_type const& param = geometry::tuples::get<I>(params);
model_type const& model = traits_type::template model<T>(param);
a = geometry::get_radius<0>(model);
@ -198,13 +198,13 @@ struct pj_ell_init_ellps_static<Params, N, N>
}
};
template <typename T, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_ell_init_ellps(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params,
template <typename T, typename ...Ps>
inline bool pj_ell_init_ellps(srs::spar::parameters<Ps...> const& params,
T &a, T &b)
{
return pj_ell_init_ellps_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
srs::spar::parameters<Ps...>
>::apply(params, a, b);
}

View File

@ -93,11 +93,11 @@ inline void pj_init_proj(srs::dpar::parameters<T> const& params,
}
}
template <typename T, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline void pj_init_proj(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& ,
template <typename T, typename ...Ps>
inline void pj_init_proj(srs::spar::parameters<Ps...> const& ,
parameters<T> & par)
{
typedef srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> params_type;
typedef srs::spar::parameters<Ps...> params_type;
typedef typename geometry::tuples::find_if
<
params_type,
@ -247,7 +247,7 @@ template
srs::spar::detail::is_param_t<srs::spar::to_meter>
>::template pred
>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct pj_init_units_static
: pj_init_units_static<Params, Vertical, UnitsI, N, N>
@ -259,7 +259,7 @@ struct pj_init_units_static<Params, Vertical, UnitsI, N, N>
static const int n = sizeof(pj_units) / sizeof(pj_units[0]);
static const int i = srs::spar::detail::units_traits
<
typename boost::tuples::element<UnitsI, Params>::type
typename geometry::tuples::element<UnitsI, Params>::type
>::id;
static const bool is_valid = i >= 0 && i < n;
@ -289,7 +289,7 @@ struct pj_init_units_static<Params, Vertical, N, ToMeterI, N>
T & to_meter, T & fr_meter,
T const& , T const& )
{
to_meter = boost::tuples::get<ToMeterI>(params).value;
to_meter = geometry::tuples::get<ToMeterI>(params).value;
fr_meter = 1. / to_meter;
}
};
@ -307,8 +307,8 @@ struct pj_init_units_static<Params, Vertical, N, N, N>
}
};
template <typename T, bool Vertical, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline void pj_init_units(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params,
template <typename T, bool Vertical, typename ...Ps>
inline void pj_init_units(srs::spar::parameters<Ps...> 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<BOOST_GEOMETRY_PROJECTIONS_DETAI
{
pj_init_units_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
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<srs::spar::detail::pm_traits>::pred
>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct pj_init_pm_static
{
template <typename T>
static void apply(Params const& params, T & val)
{
typedef typename boost::tuples::element<I, Params>::type param_type;
typedef typename geometry::tuples::element<I, Params>::type param_type;
val = srs::spar::detail::pm_traits<param_type>::value(boost::tuples::get<I>(params));
val = srs::spar::detail::pm_traits<param_type>::value(geometry::tuples::get<I>(params));
}
};
template <typename Params, int N>
@ -418,12 +418,12 @@ struct pj_init_pm_static<Params, N, N>
}
};
template <typename T, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline void pj_init_pm(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params, T& val)
template <typename T, typename ...Ps>
inline void pj_init_pm(srs::spar::parameters<Ps...> const& params, T& val)
{
pj_init_pm_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>
srs::spar::parameters<Ps...>
>::apply(params, val);
}

View File

@ -105,11 +105,11 @@ template
typename StaticParams,
typename IsParamPred,
int I = tuples_find_index_if<StaticParams, typename IsParamPred::pred>::value,
int N = boost::tuples::length<StaticParams>::value
int N = geometry::tuples::size<StaticParams>::value
>
struct pj_param_find_static
{
typedef boost::tuples::element<I, StaticParams> type;
typedef geometry::tuples::element<I, StaticParams> 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 <typename Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_param_exists(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& )
template <typename Param, typename ...Ps>
inline bool pj_param_exists(srs::spar::parameters<Ps...> const& )
{
return geometry::tuples::is_found
<
typename geometry::tuples::find_if
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
srs::spar::detail::is_param<Param>::template pred
>::type
>::value;
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_param_exists(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& )
template <template <typename> class Param, typename ...Ps>
inline bool pj_param_exists(srs::spar::parameters<Ps...> const& )
{
return geometry::tuples::is_found
<
typename geometry::tuples::find_if
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
srs::spar::detail::is_param_t<Param>::template pred
>::type
>::value;
@ -284,7 +284,7 @@ template
typename Params,
template <typename> class IsSamePred,
int I = geometry::tuples::find_index_if<Params, IsSamePred>::value,
int N = boost::tuples::length<Params>::value
int N = geometry::tuples::size<Params>::value
>
struct _pj_param_x_static
{
@ -293,7 +293,7 @@ struct _pj_param_x_static
static void apply(Params const& params, T & out)
{
// TODO: int values could be extracted directly from the type
out = boost::tuples::get<I>(params).value;
out = geometry::tuples::get<I>(params).value;
}
};
@ -311,36 +311,36 @@ struct _pj_param_x_static<Params, IsSamePred, N, N>
{}
};
template <template <int> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool _pj_param_i(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params, int & par)
template <template <int> class Param, typename ...Ps>
inline bool _pj_param_i(srs::spar::parameters<Ps...> const& params, int & par)
{
typedef _pj_param_x_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
srs::spar::detail::is_param_i<Param>::template pred
> impl;
impl::apply(params, par);
return impl::result;
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename T>
inline bool _pj_param_f(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params, T & par)
template <template <typename> class Param, typename ...Ps, typename T>
inline bool _pj_param_f(srs::spar::parameters<Ps...> const& params, T & par)
{
typedef _pj_param_x_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
srs::spar::detail::is_param_t<Param>::template pred
> impl;
impl::apply(params, par);
return impl::result;
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename T>
inline bool _pj_param_r(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params, T & par)
template <template <typename> class Param, typename ...Ps, typename T>
inline bool _pj_param_r(srs::spar::parameters<Ps...> const& params, T & par)
{
typedef _pj_param_x_static
<
srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>,
srs::spar::parameters<Ps...>,
srs::spar::detail::is_param_t<Param>::template pred
> impl;
impl::apply(params, par);
@ -349,8 +349,8 @@ inline bool _pj_param_r(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_
return impl::result;
}
template <typename Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool _pj_get_param_b(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& params)
template <typename Param, typename ...Ps>
inline bool _pj_get_param_b(srs::spar::parameters<Ps...> const& params)
{
return pj_param_exists<Param>(params);
}
@ -456,15 +456,15 @@ inline bool pj_param_exists(srs::dpar::parameters<T> const& pl,
{
return pj_param_exists(pl, n);
}
template <typename Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Name>
inline bool pj_param_exists(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <typename Param, typename ...Ps, typename Name>
inline bool pj_param_exists(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
Name const& )
{
return pj_param_exists<Param>(pl);
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Name>
inline bool pj_param_exists(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <template <typename> class Param, typename ...Ps, typename Name>
inline bool pj_param_exists(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
Name const& )
{
@ -485,8 +485,8 @@ inline bool pj_get_param_b(srs::dpar::parameters<T> const& pl,
{
return _pj_get_param_b(pl, n);
}
template <typename Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_get_param_b(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <typename Param, typename ...Ps>
inline bool pj_get_param_b(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_be const& )
{
@ -511,8 +511,8 @@ inline bool pj_param_i(srs::dpar::parameters<T> const& pl,
{
return _pj_param_i(pl, n, par);
}
template <template <int> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_param_i(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <template <int> class Param, typename ...Ps>
inline bool pj_param_i(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_i const& ,
int & par)
@ -536,8 +536,8 @@ inline int pj_get_param_i(srs::dpar::parameters<T> const& pl,
{
return _pj_get_param_i(pl, n);
}
template <template <int> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline bool pj_get_param_i(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <template <int> class Param, typename ...Ps>
inline bool pj_get_param_i(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_i const& )
{
@ -562,8 +562,8 @@ inline bool pj_param_f(srs::dpar::parameters<T> const& pl,
{
return _pj_param_f(pl, n, par);
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename T>
inline bool pj_param_f(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <template <typename> class Param, typename ...Ps, typename T>
inline bool pj_param_f(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_f const& ,
T & par)
@ -587,8 +587,8 @@ inline T pj_get_param_f(srs::dpar::parameters<T> const& pl,
{
return _pj_get_param_f<T>(pl, n);
}
template <typename T, template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline T pj_get_param_f(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <typename T, template <typename> class Param, typename ...Ps>
inline T pj_get_param_f(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_f const& )
{
@ -614,8 +614,8 @@ inline bool pj_param_r(srs::dpar::parameters<T> const& pl,
{
return _pj_param_r(pl, n, par);
}
template <template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename T>
inline bool pj_param_r(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <template <typename> class Param, typename ...Ps, typename T>
inline bool pj_param_r(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_r const& ,
T & par)
@ -639,8 +639,8 @@ inline T pj_get_param_r(srs::dpar::parameters<T> const& pl,
{
return _pj_get_param_r<T>(pl, n);
}
template <typename T, template <typename> class Param, BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
inline T pj_get_param_r(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& pl,
template <typename T, template <typename> class Param, typename ...Ps>
inline T pj_get_param_r(srs::spar::parameters<Ps...> const& pl,
std::string const& ,
srs::dpar::name_r const& )
{

View File

@ -131,15 +131,15 @@ namespace projections
return pj;
}
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Parameters>
inline Parameters o_proj_parameters(srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> const& /*params*/,
template <typename ...Ps, typename Parameters>
inline Parameters o_proj_parameters(srs::spar::parameters<Ps...> const& /*params*/,
Parameters const& par)
{
/* copy existing header into new */
Parameters pj = par;
/* get name of projection to be translated */
typedef srs::spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX> params_type;
typedef srs::spar::parameters<Ps...> params_type;
typedef typename geometry::tuples::find_if
<
params_type,

View File

@ -27,9 +27,9 @@
#include <boost/geometry/srs/sphere.hpp>
#include <boost/geometry/srs/spheroid.hpp>
#include <boost/geometry/util/sequence.hpp>
#include <boost/geometry/util/tuples.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/variant/variant.hpp>
@ -41,195 +41,104 @@ namespace spar
// Static parameters holder
#define BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX \
typename P0, typename P1, typename P2, typename P3, typename P4, \
typename P5, typename P6, typename P7, typename P8, typename P9, \
typename P10, typename P11, typename P12, typename P13, typename P14
template <typename ...>
class parameters {};
#define BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX \
P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX>
struct map_params_to_cons
{
typedef boost::tuples::cons
<
P0,
typename map_params_to_cons
<
P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14,
boost::tuples::null_type
>::type
> type;
};
template <>
struct map_params_to_cons
<
boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type
>
{
typedef boost::tuples::null_type type;
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
template
<
// null_type -> void?
typename P0 = boost::tuples::null_type,
typename P1 = boost::tuples::null_type,
typename P2 = boost::tuples::null_type,
typename P3 = boost::tuples::null_type,
typename P4 = boost::tuples::null_type,
typename P5 = boost::tuples::null_type,
typename P6 = boost::tuples::null_type,
typename P7 = boost::tuples::null_type,
typename P8 = boost::tuples::null_type,
typename P9 = boost::tuples::null_type,
typename P10 = boost::tuples::null_type,
typename P11 = boost::tuples::null_type,
typename P12 = boost::tuples::null_type,
typename P13 = boost::tuples::null_type,
typename P14 = boost::tuples::null_type
>
struct parameters
: detail::map_params_to_cons<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>::type
{
private:
typedef typename detail::map_params_to_cons<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>::type base_type;
public:
typedef typename base_type::tail_type tail_type;
parameters()
: base_type()
{}
explicit parameters(P0 const& p0)
: base_type(p0, cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1)
: base_type(p0, p1, cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2)
: base_type(p0, p1, p2, cnull(), cnull(), cnull(), cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3)
: base_type(p0, p1, p2, p3, cnull(), cnull(), cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4)
: base_type(p0, p1, p2, p3, p4, cnull(), cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5)
: base_type(p0, p1, p2, p3, p4, p5, cnull(), cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6)
: base_type(p0, p1, p2, p3, p4, p5, p6, cnull(), cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7)
: base_type(p0, p1, p2, p3, p4, p5, p6, p7, cnull(), cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8)
: base_type(p0, p1, p2, p3, p4, p5, p6, p7, p8, cnull())
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9)
: base_type(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9, P10 const& p10)
: base_type(p0,
tail_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9, P10 const& p10, P11 const& p11)
: base_type(p0,
tail_type(p1,
typename tail_type::tail_type(p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)))
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9, P10 const& p10, P11 const& p11, P12 const& p12)
: base_type(p0,
tail_type(p1,
typename tail_type::tail_type(p2,
typename tail_type::tail_type::tail_type(p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))))
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9, P10 const& p10, P11 const& p11, P12 const& p12, P13 const& p13)
: base_type(p0,
tail_type(p1,
typename tail_type::tail_type(p2,
typename tail_type::tail_type::tail_type(p3,
typename tail_type::tail_type::tail_type::tail_type(p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)))))
{}
parameters(P0 const& p0, P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5, P6 const& p6, P7 const& p7, P8 const& p8, P9 const& p9, P10 const& p10, P11 const& p11, P12 const& p12, P13 const& p13, P14 const& p14)
: base_type(p0,
tail_type(p1,
typename tail_type::tail_type(p2,
typename tail_type::tail_type::tail_type(p3,
typename tail_type::tail_type::tail_type::tail_type(p4,
typename tail_type::tail_type::tail_type::tail_type::tail_type(p5, p6, p7, p8, p9, p10, p11, p12, p13, p14))))))
{}
private:
static inline const boost::tuples::null_type cnull()
{
return boost::tuples::null_type();
}
};
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename Parameters, typename Parameter>
struct add_parameter
// TODO: implement this as a sequence utility
template <std::size_t I, typename ...>
struct parameters_base
{
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
"Invalid Parameters argument.",
Parameters);
"I out of bounds.",
std::integral_constant<size_t, I>);
};
// NOTE: parameters has to be convertible to tuples::cons
template <BOOST_GEOMETRY_PROJECTIONS_DETAIL_TYPENAME_PX, typename Parameter>
struct add_parameter<spar::parameters<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>, Parameter>
: geometry::tuples::push_back
<
typename detail::map_params_to_cons<BOOST_GEOMETRY_PROJECTIONS_DETAIL_PX>::type,
Parameter
>
{};
template <std::size_t I, typename P, typename ...Ps>
struct parameters_base<I, P, Ps...>
{
typedef typename parameters_base<I - 1, Ps...>::type type;
};
template <typename Head, typename Tail, typename Parameter>
struct add_parameter<boost::tuples::cons<Head, Tail>, Parameter>
: geometry::tuples::push_back
<
boost::tuples::cons<Head, Tail>,
Parameter
>
{};
template <typename P, typename ...Ps>
struct parameters_base<0, P, Ps...>
{
typedef parameters<P, Ps...> type;
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
template <typename P, typename ...Ps>
class parameters<P, Ps...>
: private parameters<Ps...>
{
public:
parameters() = default;
parameters(parameters const&) = default;
parameters(parameters&&) = default;
parameters & operator=(parameters const&) = default;
parameters & operator=(parameters&&) = default;
template
<
typename R, typename ...Rs,
std::enable_if_t<std::is_constructible<P, R>::value, int> = 0
>
explicit parameters(R&& r, Rs&&... rs)
: parameters<Ps...>(std::forward<Rs>(rs)...)
, m_p(std::forward<R>(r))
{}
template <std::size_t I>
auto const& get() const
{
typedef typename detail::parameters_base<I, P, Ps...>::type base_t;
return static_cast<base_t const&>(*this).m_p;
}
private:
P m_p;
template <typename ...>
friend class parameters;
};
} // namespace spar
}}} // namespace boost::geometry::srs
namespace boost { namespace geometry { namespace tuples
{
template <std::size_t I, typename ...Ts>
struct element<I, srs::spar::parameters<Ts...> >
: util::sequence_element<I, util::type_sequence<Ts...> >
{};
template <typename ...Ts>
struct size<srs::spar::parameters<Ts...> >
: std::integral_constant<std::size_t, sizeof...(Ts)>
{};
template <int I, typename ...Ts>
inline typename element<I, srs::spar::parameters<Ts...> >::type const&
get(srs::spar::parameters<Ts...> const& tup)
{
return tup.template get<I>();
}
}}} // namespace boost::geometry::tuples
namespace boost { namespace geometry { namespace srs
{
namespace spar
{
// Static parameters values

View File

@ -13,11 +13,11 @@
#ifndef BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
#define BOOST_GEOMETRY_STRATEGIES_INTERSECTION_HPP
//#include <type_traits>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/strategies/intersection.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>
@ -28,8 +28,6 @@
#include <boost/geometry/strategies/spherical/intersection.hpp>
#include <boost/geometry/strategies/spherical/ssf.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
namespace boost { namespace geometry
{
@ -63,13 +61,9 @@ private :
> ip_type;
public:
typedef policies::relate::segments_tupled
typedef policies::relate::segments_intersection_policy
<
policies::relate::segments_intersection_points
<
ip_type
> ,
policies::relate::segments_direction
ip_type
> intersection_policy_type;
typedef typename strategy::intersection::services::default_strategy

View File

@ -13,6 +13,7 @@
#ifndef BOOST_GEOMETRY_UTIL_TUPLES_HPP
#define BOOST_GEOMETRY_UTIL_TUPLES_HPP
#include <tuple>
#include <type_traits>
#include <utility>
@ -20,33 +21,149 @@
#include <boost/tuple/tuple.hpp>
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
namespace boost { namespace geometry { namespace tuples
{
#include <tuple>
#endif // BOOST_GEOMETRY_CXX11_TUPLE
namespace boost { namespace geometry { namespace tuples {
using boost::tuples::null_type;
template <int I, typename Tuple>
struct element
: boost::tuples::element<I, Tuple>
template <typename T>
struct is_tuple
: std::integral_constant<bool, false>
{};
template <typename ...Ts>
struct is_tuple<std::tuple<Ts...>>
: std::integral_constant<bool, true>
{};
template <typename F, typename S>
struct is_tuple<std::pair<F, S>>
: std::integral_constant<bool, true>
{};
template <typename ...Ts>
struct is_tuple<boost::tuples::tuple<Ts...>>
: std::integral_constant<bool, true>
{};
template <typename HT, typename TT>
struct is_tuple<boost::tuples::cons<HT, TT>>
: std::integral_constant<bool, true>
{};
template <std::size_t I, typename Tuple>
struct element;
template <std::size_t I, typename ...Ts>
struct element<I, std::tuple<Ts...>>
: std::tuple_element<I, std::tuple<Ts...>>
{};
template <std::size_t I, typename HT, typename TT>
struct element<I, std::pair<HT, TT>>
: std::tuple_element<I, std::pair<HT, TT>>
{};
template <std::size_t I, typename ...Ts>
struct element<I, boost::tuples::tuple<Ts...>>
{
typedef typename boost::tuples::element
<
I, boost::tuples::tuple<Ts...>
>::type type;
};
template <std::size_t I, typename HT, typename TT>
struct element<I, boost::tuples::cons<HT, TT>>
{
typedef typename boost::tuples::element
<
I, boost::tuples::cons<HT, TT>
>::type type;
};
template <typename Tuple>
struct size
struct size;
template <typename ...Ts>
struct size<std::tuple<Ts...>>
: std::tuple_size<std::tuple<Ts...>>
{};
template <typename HT, typename TT>
struct size<std::pair<HT, TT>>
: std::tuple_size<std::pair<HT, TT>>
{};
template <typename ...Ts>
struct size<boost::tuples::tuple<Ts...>>
: std::integral_constant
<
std::size_t,
boost::tuples::length<Tuple>::value
boost::tuples::length<boost::tuples::tuple<Ts...>>::value
>
{};
template <int I, typename HT, typename TT>
template <typename HT, typename TT>
struct size<boost::tuples::cons<HT, TT>>
: std::integral_constant
<
std::size_t,
boost::tuples::length<boost::tuples::cons<HT, TT>>::value
>
{};
template <std::size_t I, typename ...Ts>
constexpr inline typename std::tuple_element<I, std::tuple<Ts...>>::type&
get(std::tuple<Ts...> & t)
{
return std::get<I>(t);
}
template <std::size_t I, typename ...Ts>
constexpr inline typename std::tuple_element<I, std::tuple<Ts...>>::type const&
get(std::tuple<Ts...> const& t)
{
return std::get<I>(t);
}
template <std::size_t I, typename HT, typename TT>
constexpr inline typename std::tuple_element<I, std::pair<HT, TT>>::type&
get(std::pair<HT, TT> & t)
{
return std::get<I>(t);
}
template <std::size_t I, typename HT, typename TT>
constexpr inline typename std::tuple_element<I, std::pair<HT, TT>>::type const&
get(std::pair<HT, TT> const& t)
{
return std::get<I>(t);
}
template <std::size_t I, typename ...Ts>
inline typename boost::tuples::access_traits
<
typename boost::tuples::element<I, boost::tuples::tuple<Ts...>>::type
>::non_const_type
get(boost::tuples::tuple<Ts...> & t)
{
return boost::tuples::get<I>(t);
}
template <std::size_t I, typename ...Ts>
inline typename boost::tuples::access_traits
<
typename boost::tuples::element<I, boost::tuples::tuple<Ts...>>::type
>::const_type
get(boost::tuples::tuple<Ts...> const& t)
{
return boost::tuples::get<I>(t);
}
template <std::size_t I, typename HT, typename TT>
inline typename boost::tuples::access_traits
<
typename boost::tuples::element<I, boost::tuples::cons<HT, TT> >::type
@ -56,7 +173,7 @@ get(boost::tuples::cons<HT, TT> & tup)
return boost::tuples::get<I>(tup);
}
template <int I, typename HT, typename TT>
template <std::size_t I, typename HT, typename TT>
inline typename boost::tuples::access_traits
<
typename boost::tuples::element<I, boost::tuples::cons<HT, TT> >::type
@ -67,104 +184,6 @@ get(boost::tuples::cons<HT, TT> const& tup)
}
template <int I, typename F, typename S>
struct element<I, std::pair<F, S> >
{};
template <typename F, typename S>
struct element<0, std::pair<F, S> >
{
typedef F type;
};
template <typename F, typename S>
struct element<1, std::pair<F, S> >
{
typedef S type;
};
template <typename F, typename S>
struct size<std::pair<F, S> >
: std::integral_constant<std::size_t, 2>
{};
template <int I, typename Pair>
struct get_pair;
template <typename F, typename S>
struct get_pair<0, std::pair<F, S> >
{
typedef F type;
static inline F& apply(std::pair<F, S> & p)
{
return p.first;
}
static inline F const& apply(std::pair<F, S> const& p)
{
return p.first;
}
};
template <typename F, typename S>
struct get_pair<1, std::pair<F, S> >
{
typedef S type;
static inline S& apply(std::pair<F, S> & p)
{
return p.second;
}
static inline S const& apply(std::pair<F, S> const& p)
{
return p.second;
}
};
template <int I, typename F, typename S>
inline typename get_pair<I, std::pair<F, S> >::type&
get(std::pair<F, S> & p)
{
return get_pair<I, std::pair<F, S> >::apply(p);
}
template <int I, typename F, typename S>
inline typename get_pair<I, std::pair<F, S> >::type const&
get(std::pair<F, S> const& p)
{
return get_pair<I, std::pair<F, S> >::apply(p);
}
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <int I, typename ...Ts>
struct element<I, std::tuple<Ts...> >
: std::tuple_element<I, std::tuple<Ts...> >
{};
template <typename ...Ts>
struct size<std::tuple<Ts...> >
: std::tuple_size<std::tuple<Ts...> >
{};
template <int I, typename ...Ts>
inline typename std::tuple_element<I, std::tuple<Ts...> >::type&
get(std::tuple<Ts...> & tup)
{
return std::get<I>(tup);
}
template <int I, typename ...Ts>
inline typename std::tuple_element<I, std::tuple<Ts...> >::type const&
get(std::tuple<Ts...> const& tup)
{
return std::get<I>(tup);
}
#endif // BOOST_GEOMETRY_CXX11_TUPLE
// find_index_if
// Searches for the index of an element for which UnaryPredicate returns true
@ -199,7 +218,14 @@ struct find_index_if<Tuple, UnaryPred, N, N>
// find_if
// Searches for an element for which UnaryPredicate returns true
// If such element is not found the result is boost::tuples::null_type
// If such element is not found the result is detail::null_type
namespace detail
{
struct null_type {};
} // detail
template
<
@ -225,7 +251,7 @@ template
>
struct find_if<Tuple, UnaryPred, N, N>
{
typedef boost::tuples::null_type type;
typedef detail::null_type type;
};
@ -237,7 +263,7 @@ struct is_found
: std::integral_constant
<
bool,
! std::is_same<T, boost::tuples::null_type>::value
! std::is_same<T, detail::null_type>::value
>
{};
@ -247,7 +273,7 @@ struct is_found
template <typename T>
struct is_not_found
: std::is_same<T, boost::tuples::null_type>
: std::is_same<T, detail::null_type>
{};
@ -305,20 +331,13 @@ struct push_back
template <typename F, typename S, typename T>
struct push_back<std::pair<F, S>, T>
{
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
typedef std::tuple<F, S, T> type;
#else
typedef boost::tuple<F, S, T> type;
#endif // BOOST_GEOMETRY_CXX11_TUPLE
static type apply(std::pair<F, S> const& p, T const& t)
{
return type(p.first, p.second, t);
}
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
static type apply(std::pair<F, S> && p, T const& t)
{
return type(std::move(p.first), std::move(p.second), t);
@ -328,14 +347,8 @@ struct push_back<std::pair<F, S>, T>
{
return type(std::move(p.first), std::move(p.second), std::move(t));
}
#endif
#endif // BOOST_GEOMETRY_CXX11_TUPLE
};
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <typename Is, typename Tuple, typename T>
struct push_back_st;
@ -349,8 +362,6 @@ struct push_back_st<std::index_sequence<Is...>, std::tuple<Ts...>, T>
return type(std::get<Is>(tup)..., t);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
static type apply(std::tuple<Ts...> && tup, T const& t)
{
return type(std::move(std::get<Is>(tup))..., t);
@ -360,8 +371,6 @@ struct push_back_st<std::index_sequence<Is...>, std::tuple<Ts...>, T>
{
return type(std::move(std::get<Is>(tup))..., std::move(t));
}
#endif
};
template <typename ...Ts, typename T>
@ -374,8 +383,6 @@ struct push_back<std::tuple<Ts...>, T>
>
{};
#endif // BOOST_GEOMETRY_CXX11_TUPLE
}}} // namespace boost::geometry::tuples

View File

@ -5,6 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -25,9 +28,7 @@
#include <boost/geometry/strategies/cartesian/intersection.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp>

View File

@ -5,7 +5,7 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017, Oracle and/or its affiliates.
// Copyright (c) 2017-2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -24,9 +24,7 @@
#include <boost/geometry/strategies/cartesian/intersection.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp>

View File

@ -1,7 +1,8 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2016-2018, Oracle and/or its affiliates.
// 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,
@ -22,9 +23,7 @@
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/policies/relate/direction.hpp>
#include <boost/geometry/policies/relate/intersection_points.hpp>
#include <boost/geometry/policies/relate/tupled.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp>
@ -66,14 +65,10 @@ void test_strategy_one(S1 const& s1, S2 const& s2,
int opposite_id = -1)
{
typedef typename bg::coordinate_type<P>::type coord_t;
typedef bg::policies::relate::segments_tupled
<
bg::policies::relate::segments_intersection_points
<
bg::segment_intersection_points<P, bg::segment_ratio<coord_t> >
>,
bg::policies::relate::segments_direction
> policy_t;
typedef bg::policies::relate::segments_intersection_policy
<
bg::segment_intersection_points<P, bg::segment_ratio<coord_t> >
> policy_t;
typedef typename policy_t::return_type return_type;
@ -82,8 +77,8 @@ void test_strategy_one(S1 const& s1, S2 const& s2,
return_type res = strategy.apply(sr1, sr2, policy_t());
size_t const res_count = boost::get<0>(res).count;
char const res_method = boost::get<1>(res).how;
size_t const res_count = res.intersection_points.count;
char const res_method = res.direction.how;
BOOST_CHECK_MESSAGE(res_method == m,
"IP method: " << res_method << " different than expected: " << m
@ -113,9 +108,9 @@ void test_strategy_one(S1 const& s1, S2 const& s2,
if (res_count > 0 && expected_count > 0)
{
P const& res_i0 = boost::get<0>(res).intersections[0];
coord_t denom_a0 = boost::get<0>(res).fractions[0].robust_ra.denominator();
coord_t denom_b0 = boost::get<0>(res).fractions[0].robust_rb.denominator();
P const& res_i0 = res.intersection_points.intersections[0];
coord_t denom_a0 = res.intersection_points.fractions[0].robust_ra.denominator();
coord_t denom_b0 = res.intersection_points.fractions[0].robust_rb.denominator();
BOOST_CHECK_MESSAGE(equals_relaxed(res_i0, ip0, eps_scale),
"IP0: " << std::setprecision(16) << bg::wkt(res_i0) << " different than expected: " << bg::wkt(ip0)
<< " for " << bg::wkt(s1) << " and " << bg::wkt(s2));
@ -126,9 +121,9 @@ void test_strategy_one(S1 const& s1, S2 const& s2,
}
if (res_count > 1 && expected_count > 1)
{
P const& res_i1 = boost::get<0>(res).intersections[1];
coord_t denom_a1 = boost::get<0>(res).fractions[1].robust_ra.denominator();
coord_t denom_b1 = boost::get<0>(res).fractions[1].robust_rb.denominator();
P const& res_i1 = res.intersection_points.intersections[1];
coord_t denom_a1 = res.intersection_points.fractions[1].robust_ra.denominator();
coord_t denom_b1 = res.intersection_points.fractions[1].robust_rb.denominator();
BOOST_CHECK_MESSAGE(equals_relaxed(res_i1, ip1, eps_scale),
"IP1: " << std::setprecision(16) << bg::wkt(res_i1) << " different than expected: " << bg::wkt(ip1)
<< " for " << bg::wkt(s1) << " and " << bg::wkt(s2));
@ -141,7 +136,7 @@ void test_strategy_one(S1 const& s1, S2 const& s2,
if (opposite_id >= 0)
{
bool opposite = opposite_id != 0;
BOOST_CHECK_MESSAGE(opposite == boost::get<1>(res).opposite,
BOOST_CHECK_MESSAGE(opposite == res.direction.opposite,
bg::wkt(s1) << " and " << bg::wkt(s2) << (opposite_id == 0 ? " are not " : " are ") << "opposite" );
}
}

View File

@ -1,7 +1,7 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2019 Oracle and/or its affiliates.
// Copyright (c) 2019-2020 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -20,59 +20,55 @@ namespace bm = boost::mpl;
template <typename T>
struct is_double
: boost::is_same<T, double>
: std::is_same<T, double>
{};
template <typename T>
struct is_float
: boost::is_same<T, float>
: std::is_same<T, float>
{};
template <typename Tuple>
struct is_boost_tuple
: boost::integral_constant<bool, false>
: std::integral_constant<bool, false>
{};
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9>
struct is_boost_tuple<boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
: boost::integral_constant<bool, true>
template <typename ...Ts>
struct is_boost_tuple<boost::tuple<Ts...> >
: std::integral_constant<bool, true>
{};
template <typename Tuple>
struct is_boost_tuples_cons
: boost::integral_constant<bool, false>
: std::integral_constant<bool, false>
{};
template <typename HT, typename TT>
struct is_boost_tuples_cons<boost::tuples::cons<HT, TT> >
: boost::integral_constant<bool, true>
: std::integral_constant<bool, true>
{};
template <typename Tuple>
struct is_std_pair
: boost::integral_constant<bool, false>
: std::integral_constant<bool, false>
{};
template <typename F, typename S>
struct is_std_pair<std::pair<F, S> >
: boost::integral_constant<bool, true>
: std::integral_constant<bool, true>
{};
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
template <typename Tuple>
struct is_std_tuple
: boost::integral_constant<bool, false>
: std::integral_constant<bool, false>
{};
template <typename ...Ts>
struct is_std_tuple<std::tuple<Ts...> >
: boost::integral_constant<bool, true>
: std::integral_constant<bool, true>
{};
#endif
template <typename Tuple>
void test_all()
{
@ -82,13 +78,13 @@ void test_all()
BOOST_CHECK_EQUAL((bgt::get<0>(tup_id)), 1);
BOOST_CHECK_EQUAL((bgt::get<1>(tup_id)), 2.0);
BOOST_CHECK_EQUAL(int(bgt::size<tuple_id>::value), 2);
BOOST_CHECK_EQUAL((bgt::size<tuple_id>::value), 2u);
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_id, is_double>::value), 1);
BOOST_CHECK((boost::is_same<typename bgt::find_if<tuple_id, is_double>::type, double>::value));
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_id, is_double>::value), 1u);
BOOST_CHECK((std::is_same<typename bgt::find_if<tuple_id, is_double>::type, double>::value));
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_id, is_float>::value), 2);
BOOST_CHECK((boost::is_same<typename bgt::find_if<tuple_id, is_float>::type, boost::tuples::null_type>::value));
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_id, is_float>::value), 2u);
BOOST_CHECK((std::is_same<typename bgt::find_if<tuple_id, is_float>::type, bg::tuples::detail::null_type>::value));
typedef typename bgt::push_back<tuple_id, float>::type tuple_idf;
tuple_idf tup_idf = bgt::push_back<tuple_id, float>::apply(tup_id, 3.0f);
@ -97,45 +93,28 @@ void test_all()
BOOST_CHECK_EQUAL((bgt::get<1>(tup_idf)), 2.0);
BOOST_CHECK_EQUAL((bgt::get<2>(tup_idf)), 3.0f);
BOOST_CHECK_EQUAL(int(bgt::size<tuple_idf>::value), 3);
BOOST_CHECK_EQUAL((bgt::size<tuple_idf>::value), 3u);
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_idf, is_float>::value), 2);
BOOST_CHECK((boost::is_same<typename bgt::find_if<tuple_idf, is_float>::type, float>::value));
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
BOOST_CHECK_EQUAL((bgt::find_index_if<tuple_idf, is_float>::value), 2u);
BOOST_CHECK((std::is_same<typename bgt::find_if<tuple_idf, is_float>::type, float>::value));
BOOST_CHECK((
(is_boost_tuple<tuple_id>::value && is_boost_tuples_cons<tuple_idf>::value)
|| (!is_boost_tuple<tuple_id>::value && is_std_tuple<tuple_idf>::value)
));
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
tup_idf = bgt::push_back<tuple_id, float>::apply(std::move(tup_id), 3.0f);
BOOST_CHECK_EQUAL((bgt::get<0>(tup_idf)), 1);
BOOST_CHECK_EQUAL((bgt::get<1>(tup_idf)), 2.0);
BOOST_CHECK_EQUAL((bgt::get<2>(tup_idf)), 3.0f);
#endif
#else
BOOST_CHECK((is_boost_tuples_cons<tuple_idf>::type, float>::value));
#endif
}
int test_main(int, char* [])
{
test_all<boost::tuple<int, double> >();
test_all<std::pair<int, double> >();
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
test_all<std::tuple<int, double> >();
test_all<std::pair<int, double> >();
test_all<boost::tuple<int, double> >();
#endif
return 0;
}