TU-local STXXL comparator for OSMNodeIDs, needs {min,max}_value
Can not use std::less<>{} because of this.
This commit is contained in:
parent
54a9173107
commit
0fcca04150
@ -1,21 +0,0 @@
|
|||||||
#ifndef NODE_ID_HPP
|
|
||||||
#define NODE_ID_HPP
|
|
||||||
|
|
||||||
#include "util/typedefs.hpp"
|
|
||||||
|
|
||||||
namespace osrm
|
|
||||||
{
|
|
||||||
namespace extractor
|
|
||||||
{
|
|
||||||
|
|
||||||
struct Cmp
|
|
||||||
{
|
|
||||||
using value_type = OSMNodeID;
|
|
||||||
bool operator()(const value_type left, const value_type right) const { return left < right; }
|
|
||||||
value_type max_value() { return MAX_OSM_NODEID; }
|
|
||||||
value_type min_value() { return MIN_OSM_NODEID; }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // NODE_ID_HPP
|
|
@ -2,7 +2,6 @@
|
|||||||
#include "extractor/extraction_way.hpp"
|
#include "extractor/extraction_way.hpp"
|
||||||
|
|
||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "extractor/node_id.hpp"
|
|
||||||
#include "util/range_table.hpp"
|
#include "util/range_table.hpp"
|
||||||
|
|
||||||
#include "util/osrm_exception.hpp"
|
#include "util/osrm_exception.hpp"
|
||||||
@ -24,6 +23,19 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// Needed for STXXL comparison - STXXL requires max_value(), min_value(), so we can not use
|
||||||
|
// std::less<OSMNodeId>{}. Anonymous namespace to keep translation unit local.
|
||||||
|
struct OSMNodeIDSTXXLLess
|
||||||
|
{
|
||||||
|
using value_type = OSMNodeID;
|
||||||
|
bool operator()(const value_type left, const value_type right) const { return left < right; }
|
||||||
|
value_type max_value() { return MAX_OSM_NODEID; }
|
||||||
|
value_type min_value() { return MIN_OSM_NODEID; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
@ -136,7 +148,8 @@ void ExtractionContainers::PrepareNodes()
|
|||||||
{
|
{
|
||||||
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
|
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
|
||||||
TIMER_START(sorting_used_nodes);
|
TIMER_START(sorting_used_nodes);
|
||||||
stxxl::sort(used_node_id_list.begin(), used_node_id_list.end(), Cmp(), stxxl_memory);
|
stxxl::sort(used_node_id_list.begin(), used_node_id_list.end(), OSMNodeIDSTXXLLess(),
|
||||||
|
stxxl_memory);
|
||||||
TIMER_STOP(sorting_used_nodes);
|
TIMER_STOP(sorting_used_nodes);
|
||||||
std::cout << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s" << std::endl;
|
std::cout << "ok, after " << TIMER_SEC(sorting_used_nodes) << "s" << std::endl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user