Skip to content

Commit aeb81eb

Browse files
committed
Replace MPL_ASSERT with std static_assert.
Also include only necessary headers from Boost.Range.
1 parent ab9f1de commit aeb81eb

File tree

133 files changed

+1015
-989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1015
-989
lines changed

include/boost/geometry/algorithms/area.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
#include <boost/concept_check.hpp>
2323
#include <boost/core/ignore_unused.hpp>
24-
#include <boost/range/functions.hpp>
25-
#include <boost/range/metafunctions.hpp>
24+
#include <boost/range/begin.hpp>
25+
#include <boost/range/end.hpp>
26+
#include <boost/range/value_type.hpp>
2627

2728
#include <boost/variant/apply_visitor.hpp>
2829
#include <boost/variant/static_visitor.hpp>

include/boost/geometry/algorithms/assign.hpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include <boost/concept/requires.hpp>
2626
#include <boost/concept_check.hpp>
27-
#include <boost/mpl/assert.hpp>
2827
#include <boost/numeric/conversion/bounds.hpp>
2928
#include <boost/numeric/conversion/cast.hpp>
3029

@@ -41,6 +40,7 @@
4140
#include <boost/geometry/arithmetic/arithmetic.hpp>
4241
#include <boost/geometry/core/access.hpp>
4342
#include <boost/geometry/core/exterior_ring.hpp>
43+
#include <boost/geometry/core/static_assert.hpp>
4444
#include <boost/geometry/core/tags.hpp>
4545

4646
#include <boost/geometry/geometries/concepts/check.hpp>
@@ -236,20 +236,16 @@ struct assign
236236

237237
static bool const same_point_order
238238
= point_order<Geometry1>::value == point_order<Geometry2>::value;
239-
BOOST_MPL_ASSERT_MSG
240-
(
241-
(same_point_order),
242-
ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_POINT_ORDER,
243-
(types<Geometry1, Geometry2>)
244-
);
239+
BOOST_GEOMETRY_STATIC_ASSERT(
240+
same_point_order,
241+
"Assign is not supported for different point orders.",
242+
Geometry1, Geometry2);
245243
static bool const same_closure
246244
= closure<Geometry1>::value == closure<Geometry2>::value;
247-
BOOST_MPL_ASSERT_MSG
248-
(
249-
(same_closure),
250-
ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_CLOSURE,
251-
(types<Geometry1, Geometry2>)
252-
);
245+
BOOST_GEOMETRY_STATIC_ASSERT(
246+
same_closure,
247+
"Assign is not supported for different closures.",
248+
Geometry1, Geometry2);
253249

254250
dispatch::convert<Geometry2, Geometry1>::apply(geometry2, geometry1);
255251
}

include/boost/geometry/algorithms/correct.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <cstddef>
2525
#include <functional>
2626

27-
#include <boost/mpl/assert.hpp>
2827
#include <boost/range.hpp>
2928

3029
#include <boost/variant/apply_visitor.hpp>

include/boost/geometry/algorithms/detail/assign_values.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323

2424
#include <cstddef>
25+
#include <type_traits>
2526

2627
#include <boost/concept/requires.hpp>
2728
#include <boost/concept_check.hpp>
28-
#include <boost/mpl/assert.hpp>
2929
#include <boost/numeric/conversion/bounds.hpp>
3030
#include <boost/numeric/conversion/cast.hpp>
3131

@@ -34,11 +34,11 @@
3434
#include <boost/geometry/algorithms/clear.hpp>
3535
#include <boost/geometry/core/access.hpp>
3636
#include <boost/geometry/core/exterior_ring.hpp>
37+
#include <boost/geometry/core/static_assert.hpp>
3738
#include <boost/geometry/core/tags.hpp>
3839

3940
#include <boost/geometry/geometries/concepts/check.hpp>
4041

41-
4242
#include <boost/geometry/util/is_inverse_spheroidal_coordinates.hpp>
4343
#include <boost/geometry/util/for_each_coordinate.hpp>
4444

@@ -254,11 +254,9 @@ namespace dispatch
254254
template <typename GeometryTag, typename Geometry, std::size_t DimensionCount>
255255
struct assign
256256
{
257-
BOOST_MPL_ASSERT_MSG
258-
(
259-
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
260-
, (types<Geometry>)
261-
);
257+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
258+
"Not or not yet implemented for this Geometry type.",
259+
GeometryTag, Geometry, std::integral_constant<std::size_t, DimensionCount>);
262260
};
263261

264262
template <typename Point>

include/boost/geometry/algorithms/detail/calculate_point_order.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
#include <vector>
1515

16-
#include <boost/mpl/assert.hpp>
17-
1816
#include <boost/geometry/algorithms/area.hpp>
1917
#include <boost/geometry/core/point_order.hpp>
2018
#include <boost/geometry/core/radian_access.hpp>
19+
#include <boost/geometry/core/static_assert.hpp>
2120
#include <boost/geometry/strategies/geographic/point_order.hpp>
2221
#include <boost/geometry/util/math.hpp>
2322
#include <boost/geometry/util/range.hpp>
@@ -323,10 +322,9 @@ template
323322
>
324323
struct calculate_point_order
325324
{
326-
BOOST_MPL_ASSERT_MSG
327-
(
328-
false, NOT_IMPLEMENTED_FOR_THIS_TAG, (types<VersionTag>)
329-
);
325+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
326+
"Not implemented for this VersionTag.",
327+
VersionTag);
330328
};
331329

332330
template <typename Strategy>

include/boost/geometry/algorithms/detail/direction_code.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
#include <type_traits>
2020

2121
#include <boost/geometry/core/access.hpp>
22+
#include <boost/geometry/core/static_assert.hpp>
2223
#include <boost/geometry/arithmetic/infinite_line_functions.hpp>
2324
#include <boost/geometry/algorithms/detail/make/make.hpp>
2425
#include <boost/geometry/util/math.hpp>
2526
#include <boost/geometry/util/select_coordinate_type.hpp>
2627
#include <boost/geometry/util/normalize_spheroidal_coordinates.hpp>
2728

28-
#include <boost/mpl/assert.hpp>
29-
3029

3130
namespace boost { namespace geometry
3231
{
@@ -39,7 +38,9 @@ namespace detail
3938
template <typename CSTag>
4039
struct direction_code_impl
4140
{
42-
BOOST_MPL_ASSERT_MSG((false), NOT_IMPLEMENTED_FOR_THIS_CS, (CSTag));
41+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
42+
"Not implemented for this coordinate system.",
43+
CSTag);
4344
};
4445

4546
template <>
@@ -93,9 +94,10 @@ struct direction_code_impl<spherical_equatorial_tag>
9394
typedef typename coordinate_type<Point2>::type coord2_t;
9495
typedef typename cs_angular_units<Point1>::type units_t;
9596
typedef typename cs_angular_units<Point2>::type units2_t;
96-
BOOST_MPL_ASSERT_MSG((std::is_same<units_t, units2_t>::value),
97-
NOT_IMPLEMENTED_FOR_DIFFERENT_UNITS,
98-
(units_t, units2_t));
97+
BOOST_GEOMETRY_STATIC_ASSERT(
98+
(std::is_same<units_t, units2_t>::value),
99+
"Not implemented for different units.",
100+
units_t, units2_t);
99101

100102
typedef typename geometry::select_coordinate_type <Point1, Point2>::type calc_t;
101103
typedef math::detail::constants_on_spheroid<coord1_t, units_t> constants1;

include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#include <algorithm>
1616
#include <vector>
1717

18-
#include <boost/range.hpp>
19-
#include <boost/mpl/assert.hpp>
18+
#include <boost/range/begin.hpp>
19+
#include <boost/range/end.hpp>
20+
#include <boost/range/size.hpp>
21+
#include <boost/range/value_type.hpp>
2022

2123
#include <boost/geometry/core/assert.hpp>
2224
#include <boost/geometry/core/tag.hpp>

include/boost/geometry/algorithms/detail/for_each_range.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
#include <boost/concept/requires.hpp>
2626
#include <boost/core/addressof.hpp>
27-
#include <boost/mpl/assert.hpp>
2827
#include <boost/range/begin.hpp>
2928
#include <boost/range/end.hpp>
3029

30+
#include <boost/geometry/core/static_assert.hpp>
3131
#include <boost/geometry/core/tag.hpp>
3232
#include <boost/geometry/core/tag_cast.hpp>
3333
#include <boost/geometry/core/tags.hpp>
@@ -138,11 +138,9 @@ template
138138
>
139139
struct for_each_range
140140
{
141-
BOOST_MPL_ASSERT_MSG
142-
(
143-
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
144-
, (types<Geometry>)
145-
);
141+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
142+
"Not or not yet implemented for this Geometry type.",
143+
Geometry, Tag);
146144
};
147145

148146

include/boost/geometry/algorithms/detail/overlay/convert_ring.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
44

5-
// This file was modified by Oracle on 2018.
6-
// Modifications copyright (c) 2018, Oracle and/or its affiliates.
7-
5+
// This file was modified by Oracle on 2018-2020.
6+
// Modifications copyright (c) 2018-2020, Oracle and/or its affiliates.
87
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
98

109
// Use, modification and distribution is subject to the Boost Software License,
@@ -14,15 +13,15 @@
1413
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CONVERT_RING_HPP
1514
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CONVERT_RING_HPP
1615

17-
#include <boost/mpl/assert.hpp>
1816
#include <boost/range/algorithm/reverse.hpp>
1917

2018
#include <boost/geometry/algorithms/convert.hpp>
2119
#include <boost/geometry/algorithms/num_points.hpp>
2220

23-
#include <boost/geometry/core/tags.hpp>
2421
#include <boost/geometry/core/exterior_ring.hpp>
2522
#include <boost/geometry/core/interior_rings.hpp>
23+
#include <boost/geometry/core/static_assert.hpp>
24+
#include <boost/geometry/core/tags.hpp>
2625

2726
namespace boost { namespace geometry
2827
{
@@ -36,11 +35,9 @@ namespace detail { namespace overlay
3635
template<typename Tag>
3736
struct convert_ring
3837
{
39-
BOOST_MPL_ASSERT_MSG
40-
(
41-
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TAG
42-
, (types<Tag>)
43-
);
38+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
39+
"Not or not yet implemented for this geometry Tag.",
40+
Tag);
4441
};
4542

4643
template<>

include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
44

5+
// This file was modified by Oracle on 2020.
6+
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
7+
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8+
59
// Use, modification and distribution is subject to the Boost Software License,
610
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
711
// http://www.boost.org/LICENSE_1_0.txt)
@@ -11,19 +15,19 @@
1115

1216

1317
#include <boost/array.hpp>
14-
#include <boost/mpl/assert.hpp>
1518
#include <boost/range.hpp>
1619

20+
#include <boost/geometry/algorithms/convert.hpp>
21+
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
1722
#include <boost/geometry/core/assert.hpp>
18-
#include <boost/geometry/core/ring_type.hpp>
1923
#include <boost/geometry/core/exterior_ring.hpp>
2024
#include <boost/geometry/core/interior_rings.hpp>
25+
#include <boost/geometry/core/ring_type.hpp>
26+
#include <boost/geometry/core/static_assert.hpp>
2127
#include <boost/geometry/core/tags.hpp>
22-
#include <boost/geometry/algorithms/convert.hpp>
23-
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>
2428
#include <boost/geometry/geometries/concepts/check.hpp>
25-
#include <boost/geometry/util/range.hpp>
2629
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
30+
#include <boost/geometry/util/range.hpp>
2731
#include <boost/geometry/views/closeable_view.hpp>
2832
#include <boost/geometry/views/reversible_view.hpp>
2933

@@ -165,11 +169,9 @@ template
165169
>
166170
struct copy_segment_point
167171
{
168-
BOOST_MPL_ASSERT_MSG
169-
(
170-
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
171-
, (types<GeometryIn>)
172-
);
172+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
173+
"Not or not yet implemented for this Geometry type.",
174+
Tag, GeometryIn);
173175
};
174176

175177

include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
// This file was modified by Oracle on 2014-2020.
66
// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
7-
87
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
98
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
109

@@ -20,8 +19,9 @@
2019
#include <vector>
2120

2221
#include <boost/array.hpp>
23-
#include <boost/mpl/assert.hpp>
24-
#include <boost/range.hpp>
22+
#include <boost/range/begin.hpp>
23+
#include <boost/range/end.hpp>
24+
#include <boost/range/size.hpp>
2525

2626
#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
2727
#include <boost/geometry/algorithms/detail/signed_size_type.hpp>

include/boost/geometry/algorithms/detail/overlay/follow.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
44
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
55

6-
// This file was modified by Oracle on 2014, 2017, 2018, 2019, 2020.
6+
// This file was modified by Oracle on 2014-2020.
77
// Modifications copyright (c) 2014-2020 Oracle and/or its affiliates.
88
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
99
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -16,20 +16,19 @@
1616
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
1717

1818
#include <cstddef>
19+
#include <type_traits>
1920

2021
#include <boost/range.hpp>
21-
#include <boost/mpl/assert.hpp>
2222

23-
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
23+
#include <boost/geometry/algorithms/covered_by.hpp>
24+
#include <boost/geometry/algorithms/clear.hpp>
2425
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
2526
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
2627
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
27-
28-
#include <boost/geometry/algorithms/covered_by.hpp>
29-
#include <boost/geometry/algorithms/clear.hpp>
28+
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
3029
#include <boost/geometry/algorithms/detail/relate/turns.hpp>
3130
#include <boost/geometry/algorithms/detail/tupled_output.hpp>
32-
31+
#include <boost/geometry/core/static_assert.hpp>
3332
#include <boost/geometry/util/condition.hpp>
3433

3534
namespace boost { namespace geometry
@@ -202,8 +201,9 @@ struct add_isolated_point<PointOut, point_tag>
202201
template <overlay_type OverlayType, bool RemoveSpikes = true>
203202
struct action_selector
204203
{
205-
// If you get here the overlay type is not intersection or difference
206-
// BOOST_MPL_ASSERT(false);
204+
BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
205+
"If you get here the overlay type is not intersection or difference.",
206+
std::integral_constant<overlay_type, OverlayType>);
207207
};
208208

209209
// Specialization for intersection, containing the implementation

0 commit comments

Comments
 (0)