diff --git a/algorithms/trip_farthest_insertion.hpp b/algorithms/trip_farthest_insertion.hpp index 8f5c59ebb..5f41248a4 100644 --- a/algorithms/trip_farthest_insertion.hpp +++ b/algorithms/trip_farthest_insertion.hpp @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../util/dist_table_wrapper.hpp" #include +#include #include #include @@ -170,10 +171,12 @@ std::vector FarthestInsertionTrip(const NodeIDIterator &start, ////////////////////////////////////////////////////////////////////////////////////////////////// const auto component_size = std::distance(start, end); + BOOST_ASSERT(component_size >= 0); + auto max_from = -1; auto max_to = -1; - if (component_size == number_of_locations) + if (static_cast(component_size) == number_of_locations) { // find the pair of location with the biggest distance and make the pair the initial start // trip @@ -199,12 +202,14 @@ std::vector FarthestInsertionTrip(const NodeIDIterator &start, } } } - BOOST_ASSERT_MSG(max_from < number_of_locations && max_from >= 0, "start node"); - BOOST_ASSERT_MSG(max_to < number_of_locations && max_to >= 0, "start node"); + BOOST_ASSERT(max_from >= 0); + BOOST_ASSERT(max_to >= 0); + BOOST_ASSERT_MSG(static_cast(max_from) < number_of_locations, "start node"); + BOOST_ASSERT_MSG(static_cast(max_to) < number_of_locations, "start node"); return FindRoute(number_of_locations, component_size, start, end, dist_table, max_from, max_to); } } // end namespace trip } // end namespace osrm -#endif // TRIP_FARTHEST_INSERTION_HPP \ No newline at end of file +#endif // TRIP_FARTHEST_INSERTION_HPP