9
9
#include " engine/hint.hpp"
10
10
#include " util/coordinate_calculation.hpp"
11
11
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>
18
12
#include < memory>
13
+ #include < ranges>
14
+ #include < sstream>
19
15
#include < vector>
20
16
21
17
namespace osrm ::engine::api
@@ -40,15 +36,14 @@ class BaseAPI
40
36
util::json::Array waypoints;
41
37
waypoints.values .resize (parameters.coordinates .size ());
42
38
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); });
47
43
return waypoints;
48
44
}
49
45
50
- // FIXME: gcc 4.9 does not like MakeWaypoints to be protected
51
- // protected:
46
+ protected:
52
47
util::json::Object MakeWaypoint (const PhantomNodeCandidates &candidates) const
53
48
{
54
49
// TODO: check forward/reverse
@@ -60,9 +55,9 @@ class BaseAPI
60
55
61
56
// At an intersection we may have multiple phantom node candidates.
62
57
// 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);
66
61
67
62
const auto &snapped_location = candidatesSnappedLocation (candidates);
68
63
const auto &input_location = candidatesInputLocation (candidates);
@@ -109,8 +104,6 @@ class BaseAPI
109
104
return builder->CreateVector (waypoints);
110
105
}
111
106
112
- // FIXME: gcc 4.9 does not like MakeWaypoints to be protected
113
- // protected:
114
107
std::unique_ptr<fbresult::WaypointBuilder>
115
108
MakeWaypoint (flatbuffers::FlatBufferBuilder *builder,
116
109
const PhantomNodeCandidates &candidates) const
@@ -130,9 +123,9 @@ class BaseAPI
130
123
131
124
// At an intersection we may have multiple phantom node candidates.
132
125
// 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);
136
129
auto name_string = builder->CreateString (waypoint_name);
137
130
138
131
flatbuffers::Offset<flatbuffers::String> hint_string;
@@ -163,6 +156,25 @@ class BaseAPI
163
156
164
157
const datafacade::BaseDataFacade &facade;
165
158
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
+ }
166
178
};
167
179
168
180
} // namespace osrm::engine::api
0 commit comments