Run Modernizer

This commit is contained in:
Daniel J. Hofmann 2015-09-30 16:29:19 +02:00 committed by Patrick Niklaus
parent d06ac519ab
commit 71bf1edc5e
4 changed files with 18 additions and 19 deletions

View File

@ -42,8 +42,8 @@ RasterSource::RasterSource(RasterGrid _raster_data,
int _ymin,
int _ymax)
: xstep(calcSize(_xmin, _xmax, _width)), ystep(calcSize(_ymin, _ymax, _height)),
raster_data(_raster_data), width(_width), height(_height), xmin(_xmin), xmax(_xmax),
ymin(_ymin), ymax(_ymax)
raster_data(std::move(_raster_data)), width(_width), height(_height), xmin(_xmin),
xmax(_xmax), ymin(_ymin), ymax(_ymax)
{
BOOST_ASSERT(xstep != 0);
BOOST_ASSERT(ystep != 0);

View File

@ -219,8 +219,8 @@ int main(const int argc, const char *argv[]) try
}();
// Allocate a memory layout in shared memory, deallocate previous
SharedMemory *layout_memory = SharedMemoryFactory::Get(layout_region, sizeof(SharedDataLayout));
SharedDataLayout *shared_layout_ptr = new (layout_memory->Ptr()) SharedDataLayout();
auto *layout_memory = SharedMemoryFactory::Get(layout_region, sizeof(SharedDataLayout));
auto *shared_layout_ptr = new (layout_memory->Ptr()) SharedDataLayout();
shared_layout_ptr->SetBlockSize<char>(SharedDataLayout::FILE_INDEX_PATH,
file_index_path.length() + 1);

View File

@ -119,25 +119,25 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
// => in_component = [0, 1, 2, 4, 5, 3, 6, 7, 8]
// => in_range = [0, 5]
SCC_Component(std::vector<NodeID> in_component, std::vector<size_t> in_range)
: component(in_component), range(in_range)
: component(std::move(in_component)), range(std::move(in_range))
{
range.push_back(in_component.size());
range.push_back(component.size());
BOOST_ASSERT_MSG(in_component.size() >= in_range.size(),
BOOST_ASSERT_MSG(component.size() >= range.size(),
"scc component and its ranges do not match");
BOOST_ASSERT_MSG(in_component.size() > 0, "there's no scc component");
BOOST_ASSERT_MSG(*std::max_element(in_range.begin(), in_range.end()) <=
in_component.size(),
BOOST_ASSERT_MSG(component.size() > 0, "there's no scc component");
BOOST_ASSERT_MSG(*std::max_element(range.begin(), range.end()) <=
component.size(),
"scc component ranges are out of bound");
BOOST_ASSERT_MSG(*std::min_element(in_range.begin(), in_range.end()) >= 0,
BOOST_ASSERT_MSG(*std::min_element(range.begin(), range.end()) >= 0,
"invalid scc component range");
BOOST_ASSERT_MSG(std::is_sorted(std::begin(in_range), std::end(in_range)),
BOOST_ASSERT_MSG(std::is_sorted(std::begin(range), std::end(range)),
"invalid component ranges");
};
// constructor to use when whole graph is one single scc
SCC_Component(std::vector<NodeID> in_component)
: component(in_component), range({0, in_component.size()}){};
: component(std::move(in_component)), range({0, component.size()}){};
std::size_t GetNumberOfComponents() const
{
@ -322,10 +322,9 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
// compute all round trip routes
std::vector<InternalRouteResult> comp_route;
comp_route.reserve(route_result.size());
for (std::size_t r = 0; r < route_result.size(); ++r)
for (auto &elem : route_result)
{
comp_route.push_back(
ComputeRoute(phantom_node_vector, route_parameters, route_result[r]));
comp_route.push_back(ComputeRoute(phantom_node_vector, route_parameters, elem));
}
TIMER_STOP(TRIP_TIMER);

View File

@ -57,13 +57,13 @@ struct MatchingDebugInfo
for (auto &elem : candidates_list)
{
osrm::json::Array timestamps;
for (unsigned s = 0; s < elem.size(); s++)
for (auto &elem_s : elem)
{
osrm::json::Object state;
state.values["transitions"] = osrm::json::Array();
state.values["coordinate"] =
osrm::json::make_array(elem[s].first.location.lat / COORDINATE_PRECISION,
elem[s].first.location.lon / COORDINATE_PRECISION);
osrm::json::make_array(elem_s.first.location.lat / COORDINATE_PRECISION,
elem_s.first.location.lon / COORDINATE_PRECISION);
state.values["viterbi"] =
osrm::json::clamp_float(osrm::matching::IMPOSSIBLE_LOG_PROB);
state.values["pruned"] = 0u;