diff --git a/include/engine/api/base_api.hpp b/include/engine/api/base_api.hpp index 344f6499a5..4daadfc035 100644 --- a/include/engine/api/base_api.hpp +++ b/include/engine/api/base_api.hpp @@ -9,13 +9,9 @@ #include "engine/hint.hpp" #include "util/coordinate_calculation.hpp" -#include -#include -#include -#include - -#include #include +#include +#include #include namespace osrm::engine::api @@ -40,15 +36,14 @@ class BaseAPI util::json::Array waypoints; waypoints.values.resize(parameters.coordinates.size()); - boost::range::transform(waypoint_candidates, - waypoints.values.begin(), - [this](const PhantomNodeCandidates &candidates) - { return MakeWaypoint(candidates); }); + std::ranges::transform(waypoint_candidates, + waypoints.values.begin(), + [this](const PhantomNodeCandidates &candidates) + { return MakeWaypoint(candidates); }); return waypoints; } - // FIXME: gcc 4.9 does not like MakeWaypoints to be protected - // protected: + protected: util::json::Object MakeWaypoint(const PhantomNodeCandidates &candidates) const { // TODO: check forward/reverse @@ -60,9 +55,9 @@ class BaseAPI // At an intersection we may have multiple phantom node candidates. // Combine them to represent the waypoint name. - std::string waypoint_name = boost::algorithm::join( - candidates | boost::adaptors::transformed(toName) | boost::adaptors::filtered(noEmpty), - INTERSECTION_DELIMITER); + std::string waypoint_name = + join(candidates | std::views::transform(toName) | std::views::filter(noEmpty), + INTERSECTION_DELIMITER); const auto &snapped_location = candidatesSnappedLocation(candidates); const auto &input_location = candidatesInputLocation(candidates); @@ -109,8 +104,6 @@ class BaseAPI return builder->CreateVector(waypoints); } - // FIXME: gcc 4.9 does not like MakeWaypoints to be protected - // protected: std::unique_ptr MakeWaypoint(flatbuffers::FlatBufferBuilder *builder, const PhantomNodeCandidates &candidates) const @@ -130,9 +123,9 @@ class BaseAPI // At an intersection we may have multiple phantom node candidates. // Combine them to represent the waypoint name. - std::string waypoint_name = boost::algorithm::join( - candidates | boost::adaptors::transformed(toName) | boost::adaptors::filtered(noEmpty), - INTERSECTION_DELIMITER); + std::string waypoint_name = + join(candidates | std::views::transform(toName) | std::views::filter(noEmpty), + INTERSECTION_DELIMITER); auto name_string = builder->CreateString(waypoint_name); flatbuffers::Offset hint_string; @@ -163,6 +156,25 @@ class BaseAPI const datafacade::BaseDataFacade &facade; const BaseParameters ¶meters; + + private: + // Helper join function using std + template std::string join(Range &&range, const std::string &delimiter) const + { + std::ostringstream result; + auto it = std::begin(range); + const auto end = std::end(range); + + if (it != end) + { + result << *it++; + while (it != end) + { + result << delimiter << *it++; + } + } + return result.str(); + } }; } // namespace osrm::engine::api diff --git a/include/engine/guidance/collapsing_utility.hpp b/include/engine/guidance/collapsing_utility.hpp index 174dba0199..0ce3ec3a03 100644 --- a/include/engine/guidance/collapsing_utility.hpp +++ b/include/engine/guidance/collapsing_utility.hpp @@ -179,7 +179,7 @@ inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs) step.maneuver.waypoint_type == WaypointType::None; }; - boost::remove_erase_if(steps, not_is_valid); + steps.erase(std::remove_if(std::begin(steps), std::end(steps), not_is_valid), std::end(steps)); // the steps should still include depart and arrive at least BOOST_ASSERT(steps.size() >= 2);