MCPcopy Index your code
hub / github.com/PyVRP/PyVRP / Iterator

Method Iterator

pyvrp/cpp/Route.cpp:20–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18using Client = size_t;
19
20Route::Iterator::Iterator(Route const &route, size_t idx)
21 : route_(&route), trip_(route.numTrips()), idx_(0)
22{
23 assert(idx <= route.size());
24
25 auto const &trips = route.trips();
26 for (size_t trip = 0; trip != trips.size(); ++trip)
27 {
28 if (idx < trips[trip].size())
29 {
30 trip_ = trip;
31 idx_ = idx;
32 break;
33 }
34
35 idx -= trips[trip].size();
36 }
37}
38
39bool Route::Iterator::operator==(Iterator const &other) const
40{

Callers

nothing calls this directly

Calls 2

numTripsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected