Skip to content

Commit 83dab2d

Browse files
committed
use auto instead of iterator types, and related
1 parent b1bebca commit 83dab2d

File tree

84 files changed

+547
-977
lines changed

Some content is hidden

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

84 files changed

+547
-977
lines changed

include/boost/geometry/algorithms/append.hpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,15 @@ struct to_polygon_point
9191
signed_size_type ring_index, signed_size_type = 0)
9292
{
9393
using ring_type = typename ring_type<Polygon>::type;
94-
using exterior_ring_type = typename ring_return_type<Polygon>::type;
95-
using interior_ring_range_type = typename interior_return_type<Polygon>::type;
9694

9795
if (ring_index == -1)
9896
{
99-
exterior_ring_type ext_ring = exterior_ring(polygon);
97+
auto&& ext_ring = exterior_ring(polygon);
10098
to_range_point::apply<ring_type, Point>(ext_ring, point);
10199
}
102100
else if (ring_index < signed_size_type(num_interior_rings(polygon)))
103101
{
104-
interior_ring_range_type int_rings = interior_rings(polygon);
102+
auto&& int_rings = interior_rings(polygon);
105103
to_range_point::apply<ring_type, Point>(range::at(int_rings, ring_index), point);
106104
}
107105
}

include/boost/geometry/algorithms/centroid.hpp

+5-11
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include <boost/geometry/algorithms/assign.hpp>
4444
#include <boost/geometry/algorithms/convert.hpp>
4545
#include <boost/geometry/algorithms/detail/centroid/translating_transformer.hpp>
46-
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
4746
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
4847
#include <boost/geometry/algorithms/detail/visit.hpp>
4948
#include <boost/geometry/algorithms/is_empty.hpp>
@@ -255,11 +254,9 @@ struct centroid_polygon_state
255254
{
256255
centroid_range_state::apply(exterior_ring(poly), transformer, strategy, state);
257256

258-
typename interior_return_type<Polygon const>::type
259-
rings = interior_rings(poly);
260-
261-
for (typename detail::interior_iterator<Polygon const>::type
262-
it = boost::begin(rings); it != boost::end(rings); ++it)
257+
auto const& rings = interior_rings(poly);
258+
auto const end = boost::end(rings);
259+
for (auto it = boost::begin(rings); it != end; ++it)
263260
{
264261
centroid_range_state::apply(*it, transformer, strategy, state);
265262
}
@@ -352,15 +349,12 @@ struct centroid_multi
352349
Point
353350
>::type state;
354351

355-
for (typename boost::range_iterator<Multi const>::type
356-
it = boost::begin(multi);
357-
it != boost::end(multi);
358-
++it)
352+
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
359353
{
360354
Policy::apply(*it, transformer, strategy, state);
361355
}
362356

363-
if ( strategy.result(state, centroid) )
357+
if (strategy.result(state, centroid))
364358
{
365359
// translate the result back
366360
transformer.apply_reverse(centroid);

include/boost/geometry/algorithms/convert.hpp

+8-16
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
3838
#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
3939
#include <boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp>
40-
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
4140
#include <boost/geometry/algorithms/not_implemented.hpp>
4241

4342
#include <boost/geometry/arithmetic/arithmetic.hpp>
@@ -128,7 +127,7 @@ struct segment_to_range
128127
{
129128
traits::resize<Range>::apply(range, 2);
130129

131-
typename boost::range_iterator<Range>::type it = boost::begin(range);
130+
auto it = boost::begin(range);
132131

133132
assign_point_from_index<0>(segment, *it);
134133
++it;
@@ -186,8 +185,7 @@ struct range_to_range
186185
// but ok, sice below it == end()
187186

188187
size_type i = 0;
189-
for (typename boost::range_iterator<view_type const>::type it
190-
= boost::begin(view);
188+
for (auto it = boost::begin(view);
191189
it != boost::end(view) && i < n;
192190
++it, ++i)
193191
{
@@ -227,15 +225,11 @@ struct polygon_to_polygon
227225
>::type
228226
>::apply(interior_rings(destination), num_interior_rings(source));
229227

230-
typename interior_return_type<Polygon1 const>::type
231-
rings_source = interior_rings(source);
232-
typename interior_return_type<Polygon2>::type
233-
rings_dest = interior_rings(destination);
228+
auto const& rings_source = interior_rings(source);
229+
auto&& rings_dest = interior_rings(destination);
234230

235-
typename detail::interior_iterator<Polygon1 const>::type
236-
it_source = boost::begin(rings_source);
237-
typename detail::interior_iterator<Polygon2>::type
238-
it_dest = boost::begin(rings_dest);
231+
auto it_source = boost::begin(rings_source);
232+
auto it_dest = boost::begin(rings_dest);
239233

240234
for ( ; it_source != boost::end(rings_source); ++it_source, ++it_dest)
241235
{
@@ -263,10 +257,8 @@ struct multi_to_multi: private Policy
263257
{
264258
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
265259

266-
typename boost::range_iterator<Multi1 const>::type it1
267-
= boost::begin(multi1);
268-
typename boost::range_iterator<Multi2>::type it2
269-
= boost::begin(multi2);
260+
auto it1 = boost::begin(multi1);
261+
auto it2 = boost::begin(multi2);
270262

271263
for (; it1 != boost::end(multi1); ++it1, ++it2)
272264
{

include/boost/geometry/algorithms/correct.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include <boost/geometry/algorithms/area.hpp>
3232
#include <boost/geometry/algorithms/correct_closure.hpp>
33-
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
3433
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
3534
#include <boost/geometry/algorithms/detail/visit.hpp>
3635

include/boost/geometry/algorithms/correct_closure.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include <cstddef>
1717

18-
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
1918
#include <boost/geometry/algorithms/detail/multi_modify.hpp>
2019
#include <boost/geometry/algorithms/disjoint.hpp>
2120

include/boost/geometry/algorithms/densify.hpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ struct densify_range
7878
static inline void apply(FwdRng const& rng, MutRng & rng_out,
7979
T const& len, Strategies const& strategies)
8080
{
81-
typedef typename boost::range_iterator<FwdRng const>::type iterator_t;
8281
typedef typename boost::range_value<FwdRng>::type point_t;
8382

84-
iterator_t it = boost::begin(rng);
85-
iterator_t end = boost::end(rng);
83+
auto it = boost::begin(rng);
84+
auto const end = boost::end(rng);
8685

8786
if (it == end) // empty(rng)
8887
{
@@ -92,7 +91,7 @@ struct densify_range
9291
auto strategy = strategies.densify(rng);
9392
push_back_policy<MutRng> policy(rng_out);
9493

95-
iterator_t prev = it;
94+
auto prev = it;
9695
for ( ++it ; it != end ; prev = it++)
9796
{
9897
point_t const& p0 = *prev;
@@ -123,9 +122,8 @@ struct densify_ring
123122
if (boost::size(ring) <= 1)
124123
return;
125124

126-
typedef typename point_type<Geometry>::type point_t;
127-
point_t const& p0 = range::back(ring);
128-
point_t const& p1 = range::front(ring);
125+
auto const& p0 = range::back(ring);
126+
auto const& p1 = range::front(ring);
129127

130128
auto strategy = strategies.densify(ring);
131129
push_back_policy<GeometryOut> policy(ring_out);

include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,7 @@ struct buffer_multi
354354
RobustPolicy const& robust_policy,
355355
Strategies const& strategies)
356356
{
357-
for (typename boost::range_iterator<Multi const>::type
358-
it = boost::begin(multi);
359-
it != boost::end(multi);
360-
++it)
357+
for (auto it = boost::begin(multi); it != boost::end(multi); ++it)
361358
{
362359
Policy::apply(*it, collection,
363360
distance_strategy, segment_strategy,

0 commit comments

Comments
 (0)