99#include " engine/hint.hpp"
1010#include " util/coordinate_calculation.hpp"
1111
12- #include < boost/algorithm/string/join.hpp>
13- #include < boost/assert.hpp>
14- #include < boost/range/adaptor/transformed.hpp>
15- #include < boost/range/algorithm/transform.hpp>
16-
17- #include < boost/range/adaptor/filtered.hpp>
1812#include < memory>
13+ #include < ranges>
14+ #include < sstream>
1915#include < vector>
2016
2117namespace osrm ::engine::api
@@ -40,15 +36,14 @@ class BaseAPI
4036 util::json::Array waypoints;
4137 waypoints.values .resize (parameters.coordinates .size ());
4238
43- boost::range ::transform (waypoint_candidates,
44- waypoints.values .begin (),
45- [this ](const PhantomNodeCandidates &candidates)
46- { return MakeWaypoint (candidates); });
39+ std::ranges ::transform (waypoint_candidates,
40+ waypoints.values .begin (),
41+ [this ](const PhantomNodeCandidates &candidates)
42+ { return MakeWaypoint (candidates); });
4743 return waypoints;
4844 }
4945
50- // FIXME: gcc 4.9 does not like MakeWaypoints to be protected
51- // protected:
46+ protected:
5247 util::json::Object MakeWaypoint (const PhantomNodeCandidates &candidates) const
5348 {
5449 // TODO: check forward/reverse
@@ -60,9 +55,9 @@ class BaseAPI
6055
6156 // At an intersection we may have multiple phantom node candidates.
6257 // Combine them to represent the waypoint name.
63- std::string waypoint_name = boost::algorithm::join (
64- candidates | boost::adaptors::transformed (toName) | boost::adaptors::filtered (noEmpty),
65- INTERSECTION_DELIMITER);
58+ std::string waypoint_name =
59+ join ( candidates | std::views::transform (toName) | std::views::filter (noEmpty),
60+ INTERSECTION_DELIMITER);
6661
6762 const auto &snapped_location = candidatesSnappedLocation (candidates);
6863 const auto &input_location = candidatesInputLocation (candidates);
@@ -109,8 +104,6 @@ class BaseAPI
109104 return builder->CreateVector (waypoints);
110105 }
111106
112- // FIXME: gcc 4.9 does not like MakeWaypoints to be protected
113- // protected:
114107 std::unique_ptr<fbresult::WaypointBuilder>
115108 MakeWaypoint (flatbuffers::FlatBufferBuilder *builder,
116109 const PhantomNodeCandidates &candidates) const
@@ -130,9 +123,9 @@ class BaseAPI
130123
131124 // At an intersection we may have multiple phantom node candidates.
132125 // Combine them to represent the waypoint name.
133- std::string waypoint_name = boost::algorithm::join (
134- candidates | boost::adaptors::transformed (toName) | boost::adaptors::filtered (noEmpty),
135- INTERSECTION_DELIMITER);
126+ std::string waypoint_name =
127+ join ( candidates | std::views::transform (toName) | std::views::filter (noEmpty),
128+ INTERSECTION_DELIMITER);
136129 auto name_string = builder->CreateString (waypoint_name);
137130
138131 flatbuffers::Offset<flatbuffers::String> hint_string;
@@ -163,6 +156,25 @@ class BaseAPI
163156
164157 const datafacade::BaseDataFacade &facade;
165158 const BaseParameters ¶meters;
159+
160+ private:
161+ // Helper join function using std
162+ template <typename Range> std::string join (Range &&range, const std::string &delimiter) const
163+ {
164+ std::ostringstream result;
165+ auto it = std::begin (range);
166+ const auto end = std::end (range);
167+
168+ if (it != end)
169+ {
170+ result << *it++;
171+ while (it != end)
172+ {
173+ result << delimiter << *it++;
174+ }
175+ }
176+ return result.str ();
177+ }
166178};
167179
168180} // namespace osrm::engine::api
0 commit comments