Skip to content

Commit 20ce3d5

Browse files
authored
Merge pull request boostorg#778 from awulkiew/fix/clang_workarounds
Fixes/workarounds for clang 3.5-3.9
2 parents bc77b48 + c1f4912 commit 20ce3d5

File tree

7 files changed

+122
-35
lines changed

7 files changed

+122
-35
lines changed

include/boost/geometry/algorithms/area_result.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ struct area_result
143143
: detail::area::area_result<Geometry, Strategy>
144144
{};
145145

146-
template <typename ...Ts, typename Strategy>
147-
struct area_result<boost::variant<Ts...>, Strategy>
146+
template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Strategy>
147+
struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy>
148148
: geometry::area_result
149149
<
150150
typename util::select_pack_element
151151
<
152152
detail::area::more_precise_coordinate_type,
153-
Ts...
153+
BOOST_VARIANT_ENUM_PARAMS(T)
154154
>::type,
155155
Strategy
156156
>
@@ -161,14 +161,14 @@ struct area_result<Geometry, default_strategy>
161161
: detail::area::default_area_result<Geometry>
162162
{};
163163

164-
template <typename ...Ts>
165-
struct area_result<boost::variant<Ts...>, default_strategy>
164+
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
165+
struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, default_strategy>
166166
: detail::area::default_area_result
167167
<
168168
typename util::select_pack_element
169169
<
170170
detail::area::more_precise_default_area_result,
171-
Ts...
171+
BOOST_VARIANT_ENUM_PARAMS(T)
172172
>::type
173173
>
174174
{};

include/boost/geometry/geometries/point.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class point
8282
// passed for non-Cartesian coordinate systems.
8383
enum { cs_check = sizeof(CoordinateSystem) };
8484

85+
template <typename DT, bool Condition, typename T = void>
86+
struct enable_ctor_if
87+
: std::enable_if<Condition, T>
88+
{};
89+
8590
public:
8691

8792
// TODO: constexpr requires LiteralType and until C++20
@@ -124,6 +129,11 @@ class point
124129
}
125130

126131
/// @brief Constructor to set two values
132+
template
133+
<
134+
typename T = CoordinateType,
135+
typename enable_ctor_if<T, (DimensionCount >= 2), int>::type = 0
136+
>
127137
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
128138
constexpr
129139
#endif
@@ -137,6 +147,11 @@ class point
137147
}
138148

139149
/// @brief Constructor to set three values
150+
template
151+
<
152+
typename T = CoordinateType,
153+
typename enable_ctor_if<T, (DimensionCount >= 3), int>::type = 0
154+
>
140155
#if ! defined(BOOST_GEOMETRY_ENABLE_ACCESS_DEBUGGING)
141156
constexpr
142157
#endif

include/boost/geometry/geometries/variant.hpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,30 @@
2727
namespace boost { namespace geometry
2828
{
2929

30+
namespace detail
31+
{
32+
33+
template <typename ...>
34+
struct parameter_pack_first_type {};
35+
36+
template <typename T, typename ... Ts>
37+
struct parameter_pack_first_type<T, Ts...>
38+
{
39+
typedef T type;
40+
};
41+
42+
} // namespace detail
43+
3044

31-
template <typename T, typename ...Ts>
32-
struct point_type<boost::variant<T, Ts...> >
33-
: point_type<T>
45+
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
46+
struct point_type<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
47+
: point_type
48+
<
49+
typename detail::parameter_pack_first_type
50+
<
51+
BOOST_VARIANT_ENUM_PARAMS(T)
52+
>::type
53+
>
3454
{};
3555

3656

include/boost/geometry/srs/projections/dpar.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ template <typename Variant, typename T>
6565
struct find_type_index
6666
{};
6767

68-
template <typename ...Types, typename T>
69-
struct find_type_index<boost::variant<Types...>, T>
70-
: find_type_index_impl<T, 0, Types...>
68+
template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename T>
69+
struct find_type_index<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, T>
70+
: find_type_index_impl<T, 0, BOOST_VARIANT_ENUM_PARAMS(T)>
7171
{};
7272

7373

include/boost/geometry/strategies/comparable_distance_result.hpp

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,16 @@ struct comparable_distance_result
132132
{};
133133

134134

135-
template <typename Geometry1, typename ...Ts, typename Strategy>
136-
struct comparable_distance_result<Geometry1, boost::variant<Ts...>, Strategy>
135+
template
136+
<
137+
typename Geometry1,
138+
BOOST_VARIANT_ENUM_PARAMS(typename T),
139+
typename Strategy
140+
>
141+
struct comparable_distance_result
142+
<
143+
Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy
144+
>
137145
{
138146
// Select the most precise distance strategy result type
139147
// for all variant type combinations.
@@ -142,7 +150,7 @@ struct comparable_distance_result<Geometry1, boost::variant<Ts...>, Strategy>
142150
typedef typename util::select_combination_element
143151
<
144152
util::type_sequence<Geometry1>,
145-
util::type_sequence<Ts...>,
153+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>,
146154
detail::distance::more_precise_comparable_distance_result
147155
<
148156
Strategy
@@ -159,19 +167,34 @@ struct comparable_distance_result<Geometry1, boost::variant<Ts...>, Strategy>
159167

160168

161169
// Distance arguments are commutative
162-
template <typename ...Ts, typename Geometry2, typename Strategy>
163-
struct comparable_distance_result<boost::variant<Ts...>, Geometry2, Strategy>
170+
template
171+
<
172+
BOOST_VARIANT_ENUM_PARAMS(typename T),
173+
typename Geometry2,
174+
typename Strategy
175+
>
176+
struct comparable_distance_result
177+
<
178+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2, Strategy
179+
>
164180
: public comparable_distance_result
165181
<
166-
Geometry2, boost::variant<Ts...>, Strategy
182+
Geometry2, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy
167183
>
168184
{};
169185

170186

171-
template <typename ...Ts, typename ...Us, typename Strategy>
187+
template
188+
<
189+
BOOST_VARIANT_ENUM_PARAMS(typename T),
190+
BOOST_VARIANT_ENUM_PARAMS(typename U),
191+
typename Strategy
192+
>
172193
struct comparable_distance_result
173194
<
174-
boost::variant<Ts...>, boost::variant<Us...>, Strategy
195+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>,
196+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>,
197+
Strategy
175198
>
176199
{
177200
// Select the most precise distance strategy result type
@@ -180,8 +203,8 @@ struct comparable_distance_result
180203
// but is_implemented is not ready for prime time.
181204
typedef typename util::select_combination_element
182205
<
183-
util::type_sequence<Ts...>,
184-
util::type_sequence<Us...>,
206+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>,
207+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(U)>,
185208
detail::distance::more_precise_comparable_distance_result
186209
<
187210
Strategy

include/boost/geometry/strategies/default_length_result.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ struct default_length_result
7979
: resolve_strategy::default_length_result<Geometry>
8080
{};
8181

82-
template <typename ...Ts>
83-
struct default_length_result<boost::variant<Ts...> >
84-
: resolve_strategy::default_length_result<Ts...>
82+
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
83+
struct default_length_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
84+
: resolve_strategy::default_length_result<BOOST_VARIANT_ENUM_PARAMS(T)>
8585
{};
8686

8787
} // namespace resolve_variant

include/boost/geometry/strategies/distance_result.hpp

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,16 @@ struct distance_result
140140
{};
141141

142142

143-
template <typename Geometry1, typename ...Ts, typename Strategy>
144-
struct distance_result<Geometry1, boost::variant<Ts...>, Strategy>
143+
template
144+
<
145+
typename Geometry1,
146+
BOOST_VARIANT_ENUM_PARAMS(typename T),
147+
typename Strategy
148+
>
149+
struct distance_result
150+
<
151+
Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy
152+
>
145153
{
146154
// Select the most precise distance strategy result type
147155
// for all variant type combinations.
@@ -150,7 +158,7 @@ struct distance_result<Geometry1, boost::variant<Ts...>, Strategy>
150158
typedef typename util::select_combination_element
151159
<
152160
util::type_sequence<Geometry1>,
153-
util::type_sequence<Ts...>,
161+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>,
154162
detail::distance::more_precise_distance_result<Strategy>::template predicate
155163
>::type elements;
156164

@@ -164,23 +172,44 @@ struct distance_result<Geometry1, boost::variant<Ts...>, Strategy>
164172

165173

166174
// Distance arguments are commutative
167-
template <typename ...Ts, typename Geometry2, typename Strategy>
168-
struct distance_result<boost::variant<Ts...>, Geometry2, Strategy>
169-
: public distance_result<Geometry2, boost::variant<Ts...>, Strategy>
175+
template
176+
<
177+
BOOST_VARIANT_ENUM_PARAMS(typename T),
178+
typename Geometry2,
179+
typename Strategy
180+
>
181+
struct distance_result
182+
<
183+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2, Strategy
184+
>
185+
: public distance_result
186+
<
187+
Geometry2, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy
188+
>
170189
{};
171190

172191

173-
template <typename ...Ts, typename ...Us, typename Strategy>
174-
struct distance_result<boost::variant<Ts...>, boost::variant<Us...>, Strategy>
192+
template
193+
<
194+
BOOST_VARIANT_ENUM_PARAMS(typename T),
195+
BOOST_VARIANT_ENUM_PARAMS(typename U),
196+
typename Strategy
197+
>
198+
struct distance_result
199+
<
200+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>,
201+
boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>,
202+
Strategy
203+
>
175204
{
176205
// Select the most precise distance strategy result type
177206
// for all variant type combinations.
178207
// TODO: We should ignore the combinations that are not valid
179208
// but is_implemented is not ready for prime time.
180209
typedef typename util::select_combination_element
181210
<
182-
util::type_sequence<Ts...>,
183-
util::type_sequence<Us...>,
211+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(T)>,
212+
util::type_sequence<BOOST_VARIANT_ENUM_PARAMS(U)>,
184213
detail::distance::more_precise_distance_result<Strategy>::template predicate
185214
>::type elements;
186215

0 commit comments

Comments
 (0)