Skip to content

Commit

Permalink
placement of const
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels committed Sep 29, 2023
1 parent 5eb6209 commit 96ba473
Show file tree
Hide file tree
Showing 28 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion include/boost/geometry/algorithms/assign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ template <typename Geometry1, typename Geometry2>
struct assign
{
static inline void
apply(Geometry1& geometry1, const Geometry2& geometry2)
apply(Geometry1& geometry1, Geometry2 const& geometry2)
{
concepts::check<Geometry1>();
concepts::check<Geometry2 const>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ struct buffered_piece_collection
BOOST_GEOMETRY_ASSERT(pc.offsetted_count >= 0);
}

inline void add_piece_point(piece& pc, const point_type& point, bool add_to_original)
inline void add_piece_point(piece& pc, point_type const& point, bool add_to_original)
{
if (add_to_original && pc.type != strategy::buffer::buffered_concave)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
return;
}

auto append = [](auto& r, const auto& p)
auto append = [](auto& r, auto const& p)
{
using point_t = typename boost::range_value<Range>::type;
point_t rp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ inline void assign_parents(Geometry1 const& geometry1,
}
else if (info.parent.source_index >= 0)
{
const ring_info_type& parent = ring_map[info.parent];
ring_info_type const& parent = ring_map[info.parent];
bool const pos = math::larger(info.get_area(), 0);
bool const parent_pos = math::larger(parent.area, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ struct cluster_colocator<Point, CoordinateType, geometry::cartesian_tag, false>
{
CoordinateType centroid_0 = 0;
CoordinateType centroid_1 = 0;
for (const auto& index : indices)
for (auto const& index : indices)
{
centroid_0 += geometry::get<0>(turns[index].point);
centroid_1 += geometry::get<1>(turns[index].point);
}
centroid_0 /= indices.size();
centroid_1 /= indices.size();
for (const auto& index : indices)
for (auto const& index : indices)
{
geometry::set<0>(turns[index].point, centroid_0);
geometry::set<1>(turns[index].point, centroid_1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ inline void discard_duplicate_start_turns(Turns& turns,
{
if (turn.method == method_start)
{
for (const auto& op : turn.operations)
for (auto const& op : turn.operations)
{
start_turns_per_segment[adapt_id(op.seg_id)].push_back(index);
}
Expand All @@ -130,7 +130,7 @@ inline void discard_duplicate_start_turns(Turns& turns,
// Also avoid comparing "start" with itself.
if (turn.method != method_crosses && turn.method != method_start)
{
for (const auto& op : turn.operations)
for (auto const& op : turn.operations)
{
auto it = start_turns_per_segment.find(adapt_id(op.seg_id));
if (it != start_turns_per_segment.end())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct get_distance_measure<CalculationType, spherical_tag>
static result_type apply(SegmentPoint const& , SegmentPoint const& ,
Point const& )
{
const result_type result;
result_type const result;
return result;
}
};
Expand Down Expand Up @@ -125,7 +125,7 @@ inline auto get_distance_measure(SegmentPoint const& p1, SegmentPoint const& p2,
// Verify equality, without using a tolerance
// (so don't use equals or equals_point_point)
// because it is about very tiny differences.
auto identical = [](const auto& point1, const auto& point2)
auto identical = [](auto const& point1, auto const& point2)
{
return geometry::get<0>(point1) == geometry::get<0>(point2)
&& geometry::get<1>(point1) == geometry::get<1>(point2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ struct touch : public base_turn_handler
// >----->P qj is LEFT of P1 and pi is LEFT of Q2
// (the other way round is also possible)

auto has_distance = [&](const auto& r1, const auto& r2) -> bool
auto has_distance = [&](auto const& r1, auto const& r2) -> bool
{
auto const d1 = get_distance_measure(r1.at(0), r1.at(1), r2.at(1), umbrella_strategy);
auto const d2 = get_distance_measure(r2.at(1), r2.at(2), r1.at(0), umbrella_strategy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ struct get_turn_info_linear_areal
namespace ov = overlay;
typedef ov::get_turn_info_for_endpoint<EnableFirst, EnableLast> get_info_e;

const std::size_t ip_count = inters.i_info().count;
std::size_t const ip_count = inters.i_info().count;
// no intersection points
if (ip_count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ inline void assign_cluster_ids(Turns& turns, Clusters const& clusters)
}
for (auto const& kv : clusters)
{
for (const auto& index : kv.second.turn_indices)
for (auto const& index : kv.second.turn_indices)
{
turns[index].cluster_id = kv.first;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private :
template <typename Turns, typename Clusters>
static inline
bool is_self_cluster(signed_size_type cluster_id,
const Turns& turns, Clusters const& clusters)
Turns const& turns, Clusters const& clusters)
{
auto cit = clusters.find(cluster_id);
if (cit == clusters.end())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct ranked_point
struct less_by_turn_index
{
template <typename T>
inline bool operator()(const T& first, const T& second) const
inline bool operator()(T const& first, T const& second) const
{
return first.turn_index == second.turn_index
? first.index < second.index
Expand All @@ -101,7 +101,7 @@ struct less_by_turn_index
struct less_by_index
{
template <typename T>
inline bool operator()(const T& first, const T& second) const
inline bool operator()(T const& first, T const& second) const
{
// Length might be considered too
// First order by from/to
Expand All @@ -123,7 +123,7 @@ struct less_by_index
struct less_false
{
template <typename T>
inline bool operator()(const T&, const T& ) const
inline bool operator()(T const&, T const& ) const
{
return false;
}
Expand All @@ -132,14 +132,14 @@ struct less_false
template <typename PointOrigin, typename PointTurn, typename SideStrategy, typename LessOnSame, typename Compare>
struct less_by_side
{
less_by_side(const PointOrigin& p1, const PointTurn& p2, SideStrategy const& strategy)
less_by_side(PointOrigin const& p1, PointTurn const& p2, SideStrategy const& strategy)
: m_origin(p1)
, m_turn_point(p2)
, m_strategy(strategy)
{}

template <typename T>
inline bool operator()(const T& first, const T& second) const
inline bool operator()(T const& first, T const& second) const
{
typedef typename SideStrategy::cs_tag cs_tag;

Expand Down Expand Up @@ -418,7 +418,7 @@ public :

for (std::size_t i = 0; i < m_ranked_points.size(); i++)
{
const rp& ranked = m_ranked_points[i];
rp const& ranked = m_ranked_points[i];
if (ranked.direction != dir_from)
{
continue;
Expand All @@ -440,7 +440,7 @@ public :
bool handled[2] = {false, false};
for (std::size_t i = 0; i < m_ranked_points.size(); i++)
{
const rp& ranked = m_ranked_points[i];
rp const& ranked = m_ranked_points[i];
if (ranked.direction != dir_from)
{
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public :
}

inline
bool select_operation(const turn_type& turn,
bool select_operation(turn_type const& turn,
signed_size_type turn_index,
signed_size_type start_turn_index,
segment_identifier const& previous_seg_id,
Expand Down Expand Up @@ -536,7 +536,7 @@ public :
return result;
}

inline int starting_operation_index(const turn_type& turn) const
inline int starting_operation_index(turn_type const& turn) const
{
for (int i = 0; i < 2; i++)
{
Expand All @@ -548,7 +548,7 @@ public :
return -1;
}

inline bool both_finished(const turn_type& turn) const
inline bool both_finished(turn_type const& turn) const
{
for (int i = 0; i < 2; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ struct traversal_ring_creator

{
// Check operation (TODO: this might be redundant or should be catched before)
const turn_type& current_turn = m_turns[turn_index];
const turn_operation_type& op = current_turn.operations[op_index];
turn_type const& current_turn = m_turns[turn_index];
turn_operation_type const& op = current_turn.operations[op_index];
if (op.visited.finalized()
|| m_trav.is_visited(current_turn, op, turn_index, op_index))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct for_each_disjoint_geometry_if<OpId, Geometry, Tag, true>
{
BOOST_GEOMETRY_ASSERT(first != last);

const std::size_t count = boost::size(geometry);
std::size_t const count = boost::size(geometry);

// O(I)
// gather info about turns generated for contained geometries
Expand Down Expand Up @@ -229,8 +229,8 @@ class segment_watcher
template <typename TurnInfo, std::size_t OpId>
class exit_watcher
{
static const std::size_t op_id = OpId;
static const std::size_t other_op_id = (OpId + 1) % 2;
static std::size_t const op_id = OpId;
static std::size_t const other_op_id = (OpId + 1) % 2;

typedef typename TurnInfo::point_type point_type;
typedef detail::relate::point_info<point_type> point_info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ side_value(model::infinite_line<Type> const& line, Point const& p)
}

template <typename Type>
inline bool is_degenerate(const model::infinite_line<Type>& line)
inline bool is_degenerate(model::infinite_line<Type> const& line)
{
static Type const zero = 0;
return math::equals(line.a, zero) && math::equals(line.b, zero);
Expand Down
4 changes: 2 additions & 2 deletions include/boost/geometry/policies/robustness/segment_ratio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class segment_ratio
, m_approximation(0)
{}

inline segment_ratio(const Type& numerator, const Type& denominator)
inline segment_ratio(Type const& numerator, Type const& denominator)
: m_numerator(numerator)
, m_denominator(denominator)
{
Expand Down Expand Up @@ -207,7 +207,7 @@ class segment_ratio
inline Type const& numerator() const { return m_numerator; }
inline Type const& denominator() const { return m_denominator; }

inline void assign(const Type& numerator, const Type& denominator)
inline void assign(Type const& numerator, Type const& denominator)
{
m_numerator = numerator;
m_denominator = denominator;
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/util/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ struct define_half_pi
template <typename T>
struct relaxed_epsilon
{
static inline T apply(const T& factor)
static inline T apply(T const& factor)
{
return factor * std::numeric_limits<T>::epsilon();
}
Expand Down
14 changes: 7 additions & 7 deletions test/algorithms/envelope_expand/test_envelope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ struct check_result<Box, 2>
ctype
>;

static void apply(Box const& b, const type& x1, const type& y1, const type& /*z1*/,
const type& x2, const type& y2, const type& /*z2*/)
static void apply(Box const& b, type const& x1, type const& y1, type const& /*z1*/,
type const& x2, type const& y2, type const& /*z2*/)
{
BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 0>(b)), x1, 0.001);
BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 1>(b)), y1, 0.001);
Expand All @@ -64,8 +64,8 @@ struct check_result<Box, 3>
ctype
>;

static void apply(Box const& b, const type& x1, const type& y1, const type& z1,
const type& x2, const type& y2, const type& z2)
static void apply(Box const& b, type const& x1, type const& y1, type const& z1,
type const& x2, type const& y2, type const& z2)
{
BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 0>(b)), x1, 0.001);
BOOST_CHECK_CLOSE((bg::get<bg::min_corner, 1>(b)), y1, 0.001);
Expand All @@ -80,9 +80,9 @@ struct check_result<Box, 3>

template <typename Geometry, typename T>
void test_envelope(std::string const& wkt,
const T& x1, const T& x2,
const T& y1, const T& y2,
const T& z1 = 0, const T& z2 = 0)
T const& x1, T const& x2,
T const& y1, T const& y2,
T const& z1 = 0, T const& z2 = 0)
{
typedef bg::model::box<typename bg::point_type<Geometry>::type > box_type;
box_type b;
Expand Down
Loading

0 comments on commit 96ba473

Please sign in to comment.