Is the method modifying `paths`, and is it supposed to modify the path that's stored in `pathfinder`? A rule of thumb: use a non-const reference only if you want to modify the original source, otherwise use a const reference unless you explicitly need a copy for some reason.