Replace boost::unordered_{map/set} with std, also remove code duplication
This commit is contained in:
		
							parent
							
								
									5d468f2897
								
							
						
					
					
						commit
						7b73b977ff
					
				| @ -6,8 +6,8 @@ | |||||||
| #include "util/typedefs.hpp" | #include "util/typedefs.hpp" | ||||||
| 
 | 
 | ||||||
| #include <boost/range/adaptor/filtered.hpp> | #include <boost/range/adaptor/filtered.hpp> | ||||||
| #include <boost/unordered_map.hpp> |  | ||||||
| 
 | 
 | ||||||
|  | #include <unordered_map> | ||||||
| #include <utility> | #include <utility> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2,11 +2,13 @@ | |||||||
| #define OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ | #define OSRM_EXTRACTOR_RESTRICTION_GRAPH_HPP_ | ||||||
| 
 | 
 | ||||||
| #include <boost/assert.hpp> | #include <boost/assert.hpp> | ||||||
| #include <boost/unordered_map.hpp> |  | ||||||
| 
 | 
 | ||||||
| #include "util/node_based_graph.hpp" | #include "util/node_based_graph.hpp" | ||||||
|  | #include "util/std_hash.hpp" | ||||||
| #include "util/typedefs.hpp" | #include "util/typedefs.hpp" | ||||||
| 
 | 
 | ||||||
|  | #include <unordered_map> | ||||||
|  | 
 | ||||||
| namespace osrm | namespace osrm | ||||||
| { | { | ||||||
| namespace extractor | namespace extractor | ||||||
| @ -112,10 +114,10 @@ struct RestrictionGraph | |||||||
|     RestrictionRange GetRestrictions(RestrictionID id) const; |     RestrictionRange GetRestrictions(RestrictionID id) const; | ||||||
| 
 | 
 | ||||||
|     // A compressed node-based edge can only have one start node in the restriction graph.
 |     // A compressed node-based edge can only have one start node in the restriction graph.
 | ||||||
|     boost::unordered_map<EdgeKey, RestrictionID> start_edge_to_node{}; |     std::unordered_map<EdgeKey, RestrictionID> start_edge_to_node{}; | ||||||
|     // A compressed node-based edge can have multiple via nodes in the restriction graph
 |     // A compressed node-based edge can have multiple via nodes in the restriction graph
 | ||||||
|     // (as the compressed edge can appear in paths with different prefixes).
 |     // (as the compressed edge can appear in paths with different prefixes).
 | ||||||
|     boost::unordered_multimap<EdgeKey, RestrictionID> via_edge_to_node{}; |     std::unordered_multimap<EdgeKey, RestrictionID> via_edge_to_node{}; | ||||||
|     std::vector<RestrictionNode> nodes; |     std::vector<RestrictionNode> nodes; | ||||||
|     // TODO: Investigate reusing DynamicGraph. Currently it requires specific attributes
 |     // TODO: Investigate reusing DynamicGraph. Currently it requires specific attributes
 | ||||||
|     // (e.g. reversed, weight) that would not make sense for restrictions.
 |     // (e.g. reversed, weight) that would not make sense for restrictions.
 | ||||||
|  | |||||||
| @ -4,8 +4,6 @@ | |||||||
| #include "util/typedefs.hpp" | #include "util/typedefs.hpp" | ||||||
| #include <unordered_set> | #include <unordered_set> | ||||||
| 
 | 
 | ||||||
| #include <boost/unordered_set.hpp> |  | ||||||
| 
 |  | ||||||
| namespace osrm | namespace osrm | ||||||
| { | { | ||||||
| namespace extractor | namespace extractor | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 
 | 
 | ||||||
| #include "util/typedefs.hpp" | #include "util/typedefs.hpp" | ||||||
| 
 | 
 | ||||||
| #include <boost/unordered_map.hpp> | #include <unordered_map> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| namespace osrm | namespace osrm | ||||||
| @ -43,9 +43,9 @@ class TurnPathCompressor | |||||||
|     // via nodes are the same.
 |     // via nodes are the same.
 | ||||||
|     // Similarly, we do not compress the instruction via node in a maneuver override, as we need
 |     // Similarly, we do not compress the instruction via node in a maneuver override, as we need
 | ||||||
|     // this to identify the location of the maneuver during routing path-processing.
 |     // this to identify the location of the maneuver during routing path-processing.
 | ||||||
|     boost::unordered_multimap<NodeID, TurnPath *> starts; |     std::unordered_multimap<NodeID, TurnPath *> starts; | ||||||
|     boost::unordered_multimap<NodeID, TurnPath *> vias; |     std::unordered_multimap<NodeID, TurnPath *> vias; | ||||||
|     boost::unordered_multimap<NodeID, TurnPath *> ends; |     std::unordered_multimap<NodeID, TurnPath *> ends; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace extractor
 | } // namespace extractor
 | ||||||
|  | |||||||
| @ -1,17 +1,17 @@ | |||||||
| #ifndef OSRM_EXTRACTOR_WAY_RESTRICTION_MAP_HPP_ | #ifndef OSRM_EXTRACTOR_WAY_RESTRICTION_MAP_HPP_ | ||||||
| #define OSRM_EXTRACTOR_WAY_RESTRICTION_MAP_HPP_ | #define OSRM_EXTRACTOR_WAY_RESTRICTION_MAP_HPP_ | ||||||
| 
 | 
 | ||||||
| #include <utility> |  | ||||||
| #include <vector> |  | ||||||
| 
 |  | ||||||
| // to access the turn restrictions
 |  | ||||||
| #include <boost/unordered_map.hpp> |  | ||||||
| 
 | 
 | ||||||
| #include "extractor/restriction.hpp" | #include "extractor/restriction.hpp" | ||||||
| #include "extractor/restriction_graph.hpp" | #include "extractor/restriction_graph.hpp" | ||||||
| #include "util/integer_range.hpp" | #include "util/integer_range.hpp" | ||||||
| #include "util/typedefs.hpp" | #include "util/typedefs.hpp" | ||||||
| 
 | 
 | ||||||
|  | // to access the turn restrictions
 | ||||||
|  | #include <unordered_map> | ||||||
|  | #include <utility> | ||||||
|  | #include <vector> | ||||||
|  | 
 | ||||||
| namespace osrm | namespace osrm | ||||||
| { | { | ||||||
| namespace extractor | namespace extractor | ||||||
|  | |||||||
| @ -3,10 +3,10 @@ | |||||||
| #include "engine/datafacade/datafacade_base.hpp" | #include "engine/datafacade/datafacade_base.hpp" | ||||||
| 
 | 
 | ||||||
| #include <boost/assert.hpp> | #include <boost/assert.hpp> | ||||||
| #include <boost/unordered_set.hpp> |  | ||||||
| 
 | 
 | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <iterator> | #include <iterator> | ||||||
|  | #include <unordered_set> | ||||||
| #include <tuple> | #include <tuple> | ||||||
| 
 | 
 | ||||||
| namespace osrm | namespace osrm | ||||||
| @ -106,8 +106,8 @@ bool Hint::IsValid(const util::Coordinate new_input_coordinates, | |||||||
| 
 | 
 | ||||||
|     // Check hints do not contain duplicate segment pairs
 |     // Check hints do not contain duplicate segment pairs
 | ||||||
|     // We can't allow duplicates as search heaps do not support it.
 |     // We can't allow duplicates as search heaps do not support it.
 | ||||||
|     boost::unordered_set<NodeID> forward_segments; |     std::unordered_set<NodeID> forward_segments; | ||||||
|     boost::unordered_set<NodeID> reverse_segments; |     std::unordered_set<NodeID> reverse_segments; | ||||||
|     for (const auto &seg_hint : segment_hints) |     for (const auto &seg_hint : segment_hints) | ||||||
|     { |     { | ||||||
|         const auto forward_res = forward_segments.insert(seg_hint.phantom.forward_segment_id.id); |         const auto forward_res = forward_segments.insert(seg_hint.phantom.forward_segment_id.id); | ||||||
|  | |||||||
| @ -34,20 +34,6 @@ | |||||||
| #include <tbb/parallel_for.h> | #include <tbb/parallel_for.h> | ||||||
| #include <tbb/parallel_pipeline.h> | #include <tbb/parallel_pipeline.h> | ||||||
| 
 | 
 | ||||||
| namespace std |  | ||||||
| { |  | ||||||
| template <> struct hash<std::pair<NodeID, NodeID>> |  | ||||||
| { |  | ||||||
|     std::size_t operator()(const std::pair<NodeID, NodeID> &mk) const noexcept |  | ||||||
|     { |  | ||||||
|         std::size_t seed = 0; |  | ||||||
|         boost::hash_combine(seed, mk.first); |  | ||||||
|         boost::hash_combine(seed, mk.second); |  | ||||||
|         return seed; |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
| } // namespace std
 |  | ||||||
| 
 |  | ||||||
| namespace osrm | namespace osrm | ||||||
| { | { | ||||||
| namespace extractor | namespace extractor | ||||||
| @ -1283,7 +1269,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( | |||||||
| std::vector<ConditionalTurnPenalty> | std::vector<ConditionalTurnPenalty> | ||||||
| EdgeBasedGraphFactory::IndexConditionals(std::vector<Conditional> &&conditionals) const | EdgeBasedGraphFactory::IndexConditionals(std::vector<Conditional> &&conditionals) const | ||||||
| { | { | ||||||
|     boost::unordered_multimap<std::pair<NodeID, NodeID>, ConditionalTurnPenalty *> index; |     std::unordered_multimap<std::pair<NodeID, NodeID>, ConditionalTurnPenalty *> index; | ||||||
| 
 | 
 | ||||||
|     // build and index of all conditional restrictions
 |     // build and index of all conditional restrictions
 | ||||||
|     for (auto &conditional : conditionals) |     for (auto &conditional : conditionals) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user