Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/command-line-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void command_line_app_t::init_logging_options(bool with_progress, bool with_sql)
if (with_progress) {
add_option_function<std::string>(
"--log-progress",
[&](std::string const &arg) {
[](std::string const &arg) {
if (arg == "true") {
get_logger().enable_progress();
} else if (arg == "false") {
Expand Down
2 changes: 1 addition & 1 deletion src/command-line-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ options_t parse_command_line(int argc, char *argv[])
options.projection =
reprojection_t::create_projection(arg);
#else
[&](int) {
[](int) {
throw std::runtime_error{
"Generic projections not available in this build."};
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/geom-box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ box_t envelope(geom::collection_t const &geom)

box_t envelope(geometry_t const &geom)
{
return geom.visit([&](auto const &g) { return envelope(g); });
return geom.visit([](auto const &g) { return envelope(g); });
}

} // namespace geom
44 changes: 21 additions & 23 deletions src/geom-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,16 @@ std::string_view geometry_type(geometry_t const &geom)
{
using namespace std::literals::string_view_literals;
return geom.visit(overloaded{
[&](geom::nullgeom_t const & /*input*/) { return "NULL"sv; },
[&](geom::point_t const & /*input*/) { return "POINT"sv; },
[&](geom::linestring_t const & /*input*/) { return "LINESTRING"sv; },
[&](geom::polygon_t const & /*input*/) { return "POLYGON"sv; },
[&](geom::multipoint_t const & /*input*/) { return "MULTIPOINT"sv; },
[&](geom::multilinestring_t const & /*input*/) {
[](geom::nullgeom_t const & /*input*/) { return "NULL"sv; },
[](geom::point_t const & /*input*/) { return "POINT"sv; },
[](geom::linestring_t const & /*input*/) { return "LINESTRING"sv; },
[](geom::polygon_t const & /*input*/) { return "POLYGON"sv; },
[](geom::multipoint_t const & /*input*/) { return "MULTIPOINT"sv; },
[](geom::multilinestring_t const & /*input*/) {
return "MULTILINESTRING"sv;
},
[&](geom::multipolygon_t const & /*input*/) {
return "MULTIPOLYGON"sv;
},
[&](geom::collection_t const & /*input*/) {
[](geom::multipolygon_t const & /*input*/) { return "MULTIPOLYGON"sv; },
[](geom::collection_t const & /*input*/) {
return "GEOMETRYCOLLECTION"sv;
}});
}
Expand All @@ -62,7 +60,7 @@ std::string_view geometry_type(geometry_t const &geom)
std::size_t num_geometries(geometry_t const &geom)
{
return geom.visit(
[&](auto const &input) { return input.num_geometries(); });
[](auto const &input) { return input.num_geometries(); });
}

/****************************************************************************/
Expand Down Expand Up @@ -353,14 +351,14 @@ geometry_t segmentize(geometry_t const &input, double max_segment_length)
double area(geometry_t const &geom)
{
return std::abs(geom.visit(
overloaded{[&](geom::nullgeom_t const & /*input*/) { return 0.0; },
[&](geom::collection_t const &input) {
overloaded{[](geom::nullgeom_t const & /*input*/) { return 0.0; },
[](geom::collection_t const &input) {
return std::accumulate(input.cbegin(), input.cend(), 0.0,
[](double sum, auto const &geom) {
return sum + area(geom);
});
},
[&](auto const &input) {
[](auto const &input) {
return static_cast<double>(boost::geometry::area(input));
}}));
}
Expand Down Expand Up @@ -390,37 +388,37 @@ double spherical_area(geometry_t const &geom)
assert(geom.srid() == PROJ_LATLONG);

return std::abs(geom.visit(overloaded{
[&](geom::nullgeom_t const & /*input*/) { return 0.0; },
[&](geom::collection_t const &input) {
[](geom::nullgeom_t const & /*input*/) { return 0.0; },
[](geom::collection_t const &input) {
return std::accumulate(input.cbegin(), input.cend(), 0.0,
[](double sum, auto const &geom) {
return sum + spherical_area(geom);
});
},
[&](geom::polygon_t const &input) { return spherical_area(input); },
[&](geom::multipolygon_t const &input) {
[](geom::polygon_t const &input) { return spherical_area(input); },
[](geom::multipolygon_t const &input) {
return std::accumulate(input.cbegin(), input.cend(), 0.0,
[&](double sum, auto const &geom) {
[](double sum, auto const &geom) {
return sum + spherical_area(geom);
});
},
[&](auto const & /*input*/) { return 0.0; }}));
[](auto const & /*input*/) { return 0.0; }}));
}

/****************************************************************************/

double length(geometry_t const &geom)
{
return geom.visit(overloaded{
[&](geom::nullgeom_t const & /*input*/) { return 0.0; },
[&](geom::collection_t const &input) {
[](geom::nullgeom_t const & /*input*/) { return 0.0; },
[](geom::collection_t const &input) {
double total = 0.0;
for (auto const &item : input) {
total += length(item);
}
return total;
},
[&](auto const &input) {
[](auto const &input) {
return static_cast<double>(boost::geometry::length(input));
}});
}
Expand Down
2 changes: 1 addition & 1 deletion src/geom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::size_t dimension(collection_t const &geom)

std::size_t dimension(geometry_t const &geom)
{
return geom.visit([&](auto const &input) { return dimension(input); });
return geom.visit([](auto const &input) { return dimension(input); });
}

} // namespace geom
4 changes: 2 additions & 2 deletions src/locator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void locator_t::build_index()
void locator_t::all_intersecting_visit(geom::geometry_t const &geom,
std::set<std::string> *results)
{
geom.visit(overloaded{[&](geom::nullgeom_t const & /*val*/) {},
geom.visit(overloaded{[](geom::nullgeom_t const & /*val*/) {},
[&](geom::collection_t const &val) {
for (auto const &sgeom : val) {
all_intersecting_visit(sgeom, results);
Expand Down Expand Up @@ -120,7 +120,7 @@ std::set<std::string> locator_t::all_intersecting(geom::geometry_t const &geom)
void locator_t::first_intersecting_visit(geom::geometry_t const &geom,
std::string *result)
{
geom.visit(overloaded{[&](geom::nullgeom_t const & /*val*/) {},
geom.visit(overloaded{[](geom::nullgeom_t const & /*val*/) {},
[&](geom::collection_t const &val) {
for (auto const &sgeom : val) {
first_intersecting_visit(sgeom, result);
Expand Down
2 changes: 1 addition & 1 deletion src/wkb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void write_collection(std::string *data, geom::collection_t const &geom,

for (auto const &item : geom) {
item.visit(overloaded{
[&](geom::nullgeom_t const & /*input*/) {},
[](geom::nullgeom_t const & /*input*/) {},
[&](geom::point_t const &input) { write_point(data, input); },
[&](geom::linestring_t const &input) {
write_linestring(data, input);
Expand Down
Loading