Replace boost::optional with std::optional (#6611)
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
|
||||
@@ -122,7 +122,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
||||
const EdgeWeight new_weight = reverseHeapNode->weight + heapNode.weight;
|
||||
if (new_weight < upper_bound)
|
||||
{
|
||||
if (shouldForceStep(force_step_nodes, heapNode, reverseHeapNode.get()) ||
|
||||
if (shouldForceStep(force_step_nodes, heapNode, *reverseHeapNode) ||
|
||||
// in this case we are looking at a bi-directional way where the source
|
||||
// and target phantom are on the same edge based node
|
||||
new_weight < EdgeWeight{0})
|
||||
|
||||
@@ -408,7 +408,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
||||
auto reverse_weight = reverseHeapNode->weight;
|
||||
auto path_weight = weight + reverse_weight;
|
||||
|
||||
if (!shouldForceStep(force_step_nodes, heapNode, reverseHeapNode.get()) &&
|
||||
if (!shouldForceStep(force_step_nodes, heapNode, *reverseHeapNode) &&
|
||||
(path_weight >= EdgeWeight{0}) && (path_weight < path_upper_bound))
|
||||
{
|
||||
middle_node = heapNode.node;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
namespace osrm::extractor::intersection
|
||||
@@ -42,10 +42,10 @@ class NodeBasedGraphWalker
|
||||
* selector not provinding any further edge to traverse)
|
||||
*/
|
||||
template <class accumulator_type, class selector_type>
|
||||
boost::optional<std::pair<NodeID, EdgeID>> TraverseRoad(NodeID starting_at_node_id,
|
||||
EdgeID following_edge_id,
|
||||
accumulator_type &accumulator,
|
||||
const selector_type &selector) const;
|
||||
std::optional<std::pair<NodeID, EdgeID>> TraverseRoad(NodeID starting_at_node_id,
|
||||
EdgeID following_edge_id,
|
||||
accumulator_type &accumulator,
|
||||
const selector_type &selector) const;
|
||||
|
||||
private:
|
||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||
@@ -111,11 +111,11 @@ struct SelectRoadByNameOnlyChoiceAndStraightness
|
||||
* traversal. If no such edge is found, return {} is allowed. Usually you want to choose some
|
||||
* form of obious turn to follow.
|
||||
*/
|
||||
boost::optional<EdgeID> operator()(const NodeID nid,
|
||||
const EdgeID via_edge_id,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||
std::optional<EdgeID> operator()(const NodeID nid,
|
||||
const EdgeID via_edge_id,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||
|
||||
private:
|
||||
const NameID desired_name_id;
|
||||
@@ -138,11 +138,11 @@ struct SelectStraightmostRoadByNameAndOnlyChoice
|
||||
* traversal. If no such edge is found, return {} is allowed. Usually you want to choose some
|
||||
* form of obious turn to follow.
|
||||
*/
|
||||
boost::optional<EdgeID> operator()(const NodeID nid,
|
||||
const EdgeID via_edge_id,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||
std::optional<EdgeID> operator()(const NodeID nid,
|
||||
const EdgeID via_edge_id,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const EdgeBasedNodeDataContainer &node_data_container) const;
|
||||
|
||||
private:
|
||||
const NameID desired_name_id;
|
||||
@@ -187,7 +187,7 @@ struct IntersectionFinderAccumulator
|
||||
};
|
||||
|
||||
template <class accumulator_type, class selector_type>
|
||||
boost::optional<std::pair<NodeID, EdgeID>>
|
||||
std::optional<std::pair<NodeID, EdgeID>>
|
||||
NodeBasedGraphWalker::TraverseRoad(NodeID current_node_id,
|
||||
EdgeID current_edge_id,
|
||||
accumulator_type &accumulator,
|
||||
@@ -254,19 +254,19 @@ NodeBasedGraphWalker::TraverseRoad(NodeID current_node_id,
|
||||
|
||||
struct SkipTrafficSignalBarrierRoadSelector
|
||||
{
|
||||
boost::optional<EdgeID> operator()(const NodeID,
|
||||
const EdgeID,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &,
|
||||
const EdgeBasedNodeDataContainer &) const
|
||||
std::optional<EdgeID> operator()(const NodeID,
|
||||
const EdgeID,
|
||||
const IntersectionView &intersection,
|
||||
const util::NodeBasedDynamicGraph &,
|
||||
const EdgeBasedNodeDataContainer &) const
|
||||
{
|
||||
if (intersection.isTrafficSignalOrBarrier())
|
||||
{
|
||||
return boost::make_optional(intersection[1].eid);
|
||||
return std::make_optional(intersection[1].eid);
|
||||
}
|
||||
else
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "maneuver_override.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -55,7 +55,7 @@ class ManeuverOverrideRelationParser
|
||||
{
|
||||
public:
|
||||
ManeuverOverrideRelationParser();
|
||||
boost::optional<InputManeuverOverride> TryParse(const osmium::Relation &relation) const;
|
||||
std::optional<InputManeuverOverride> TryParse(const osmium::Relation &relation) const;
|
||||
};
|
||||
} // namespace osrm::extractor
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
namespace osrm::extractor
|
||||
{
|
||||
@@ -80,7 +80,7 @@ struct ProfileProperties
|
||||
}
|
||||
|
||||
// Check if this classes are excludable
|
||||
boost::optional<std::size_t> ClassesAreExcludable(ClassData classes) const
|
||||
std::optional<std::size_t> ClassesAreExcludable(ClassData classes) const
|
||||
{
|
||||
auto iter = std::find(excludable_classes.begin(), excludable_classes.end(), classes);
|
||||
if (iter != excludable_classes.end())
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm::guidance
|
||||
{
|
||||
|
||||
@@ -129,7 +128,7 @@ class IntersectionHandler
|
||||
// ^ via
|
||||
//
|
||||
// For this scenario returns intersection at `b` and `b`.
|
||||
boost::optional<IntersectionHandler::IntersectionViewAndNode>
|
||||
std::optional<IntersectionHandler::IntersectionViewAndNode>
|
||||
getNextIntersection(const NodeID at, const EdgeID via) const;
|
||||
|
||||
bool isSameName(const EdgeID source_edge_id, const EdgeID target_edge_id) const;
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
|
||||
#include "util/node_based_graph.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm::guidance
|
||||
{
|
||||
|
||||
@@ -43,9 +42,9 @@ class SliproadHandler final : public IntersectionHandler
|
||||
Intersection intersection) const override final;
|
||||
|
||||
private:
|
||||
boost::optional<std::size_t> getObviousIndexWithSliproads(const EdgeID from,
|
||||
const Intersection &intersection,
|
||||
const NodeID at) const;
|
||||
std::optional<std::size_t> getObviousIndexWithSliproads(const EdgeID from,
|
||||
const Intersection &intersection,
|
||||
const NodeID at) const;
|
||||
|
||||
// Next intersection from `start` onto `onto` is too far away for a Siproad scenario
|
||||
bool nextIntersectionIsTooFarAway(const NodeID start, const EdgeID onto) const;
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
#include "util/attributes.hpp"
|
||||
#include "util/node_based_graph.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -72,7 +71,7 @@ class TurnHandler final : public IntersectionHandler
|
||||
|
||||
bool hasObvious(const EdgeID &via_edge, const Fork &fork) const;
|
||||
|
||||
boost::optional<Fork> findForkCandidatesByGeometry(Intersection &intersection) const;
|
||||
std::optional<Fork> findForkCandidatesByGeometry(Intersection &intersection) const;
|
||||
|
||||
bool isCompatibleByRoadClass(const Intersection &intersection, const Fork fork) const;
|
||||
|
||||
@@ -96,7 +95,7 @@ class TurnHandler final : public IntersectionHandler
|
||||
handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const;
|
||||
|
||||
// Classification
|
||||
boost::optional<Fork> findFork(const EdgeID via_edge, Intersection &intersection) const;
|
||||
std::optional<Fork> findFork(const EdgeID via_edge, Intersection &intersection) const;
|
||||
|
||||
OSRM_ATTR_WARN_UNUSED
|
||||
Intersection assignLeftTurns(const EdgeID via_edge,
|
||||
|
||||
@@ -39,7 +39,7 @@ template <typename Key, typename Value> struct CSVFilesParser
|
||||
{
|
||||
}
|
||||
|
||||
// Operator returns a lambda function that maps input Key to boost::optional<Value>.
|
||||
// Operator returns a lambda function that maps input Key to std::optional<Value>.
|
||||
auto operator()(const std::vector<std::string> &csv_filenames) const
|
||||
{
|
||||
try
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm::updater
|
||||
@@ -12,9 +11,9 @@ namespace osrm::updater
|
||||
|
||||
template <typename Key, typename Value> struct LookupTable
|
||||
{
|
||||
boost::optional<Value> operator()(const Key &key) const
|
||||
std::optional<Value> operator()(const Key &key) const
|
||||
{
|
||||
using Result = boost::optional<Value>;
|
||||
using Result = std::optional<Value>;
|
||||
const auto it =
|
||||
std::lower_bound(lookup.begin(),
|
||||
lookup.end(),
|
||||
@@ -50,7 +49,7 @@ struct SpeedSource final
|
||||
{
|
||||
SpeedSource() : speed(0.), rate() {}
|
||||
double speed;
|
||||
boost::optional<double> rate;
|
||||
std::optional<double> rate;
|
||||
std::uint8_t source;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#include "util/coordinate.hpp"
|
||||
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -109,9 +109,9 @@ double bearing(const Coordinate first_coordinate, const Coordinate second_coordi
|
||||
double computeAngle(const Coordinate first, const Coordinate second, const Coordinate third);
|
||||
|
||||
// find the center of a circle through three coordinates
|
||||
boost::optional<Coordinate> circleCenter(const Coordinate first_coordinate,
|
||||
const Coordinate second_coordinate,
|
||||
const Coordinate third_coordinate);
|
||||
std::optional<Coordinate> circleCenter(const Coordinate first_coordinate,
|
||||
const Coordinate second_coordinate,
|
||||
const Coordinate third_coordinate);
|
||||
|
||||
// find the radius of a circle through three coordinates
|
||||
double circleRadius(const Coordinate first_coordinate,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef OSRM_GEOJSON_DEBUG_POLICIES
|
||||
#define OSRM_GEOJSON_DEBUG_POLICIES
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "extractor/query_node.hpp"
|
||||
@@ -9,8 +10,6 @@
|
||||
#include "util/node_based_graph.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm::util
|
||||
{
|
||||
|
||||
@@ -20,7 +19,7 @@ struct NodeIdVectorToLineString
|
||||
|
||||
// converts a vector of node ids into a linestring geojson feature
|
||||
util::json::Object operator()(const std::vector<NodeID> &node_ids,
|
||||
const boost::optional<json::Object> &properties = {}) const;
|
||||
const std::optional<json::Object> &properties = {}) const;
|
||||
|
||||
const std::vector<util::Coordinate> &node_coordinates;
|
||||
};
|
||||
@@ -29,7 +28,7 @@ struct CoordinateVectorToLineString
|
||||
{
|
||||
// converts a vector of node ids into a linestring geojson feature
|
||||
util::json::Object operator()(const std::vector<util::Coordinate> &coordinates,
|
||||
const boost::optional<json::Object> &properties = {}) const;
|
||||
const std::optional<json::Object> &properties = {}) const;
|
||||
};
|
||||
|
||||
struct NodeIdVectorToMultiPoint
|
||||
@@ -38,7 +37,7 @@ struct NodeIdVectorToMultiPoint
|
||||
|
||||
// converts a vector of node ids into a linestring geojson feature
|
||||
util::json::Object operator()(const std::vector<NodeID> &node_ids,
|
||||
const boost::optional<json::Object> &properties = {}) const;
|
||||
const std::optional<json::Object> &properties = {}) const;
|
||||
|
||||
const std::vector<util::Coordinate> &node_coordinates;
|
||||
};
|
||||
@@ -47,7 +46,7 @@ struct CoordinateVectorToMultiPoint
|
||||
{
|
||||
// converts a vector of node ids into a linestring geojson feature
|
||||
util::json::Object operator()(const std::vector<util::Coordinate> &coordinates,
|
||||
const boost::optional<json::Object> &properties = {}) const;
|
||||
const std::optional<json::Object> &properties = {}) const;
|
||||
};
|
||||
|
||||
} // namespace osrm::util
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
namespace osrm::util
|
||||
{
|
||||
@@ -84,7 +83,7 @@ struct NodeIdToCoordinate
|
||||
|
||||
inline util::json::Object makeFeature(std::string type,
|
||||
util::json::Array coordinates,
|
||||
const boost::optional<util::json::Object> &properties = {})
|
||||
const std::optional<util::json::Object> &properties = {})
|
||||
{
|
||||
util::json::Object result;
|
||||
result.values["type"] = "Feature";
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/heap/d_ary_heap.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
@@ -290,26 +290,26 @@ class QueryHeap
|
||||
return inserted_nodes[index].node == node;
|
||||
}
|
||||
|
||||
boost::optional<HeapNode &> GetHeapNodeIfWasInserted(const NodeID node)
|
||||
HeapNode *GetHeapNodeIfWasInserted(const NodeID node)
|
||||
{
|
||||
const auto index = node_index.peek_index(node);
|
||||
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) ||
|
||||
inserted_nodes[index].node != node)
|
||||
{
|
||||
return {};
|
||||
return nullptr;
|
||||
}
|
||||
return inserted_nodes[index];
|
||||
return &inserted_nodes[index];
|
||||
}
|
||||
|
||||
boost::optional<const HeapNode &> GetHeapNodeIfWasInserted(const NodeID node) const
|
||||
const HeapNode *GetHeapNodeIfWasInserted(const NodeID node) const
|
||||
{
|
||||
const auto index = node_index.peek_index(node);
|
||||
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) ||
|
||||
inserted_nodes[index].node != node)
|
||||
{
|
||||
return {};
|
||||
return nullptr;
|
||||
}
|
||||
return inserted_nodes[index];
|
||||
return &inserted_nodes[index];
|
||||
}
|
||||
|
||||
NodeID Min() const
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/geometry.hpp>
|
||||
#include <boost/geometry/index/rtree.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
|
||||
namespace osrm::updater
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class Timezoner
|
||||
Timezoner(const char geojson[], std::time_t utc_time_now);
|
||||
Timezoner(const boost::filesystem::path &tz_shapes_filename, std::time_t utc_time_now);
|
||||
|
||||
boost::optional<struct tm> operator()(const point_t &point) const;
|
||||
std::optional<struct tm> operator()(const point_t &point) const;
|
||||
|
||||
private:
|
||||
void LoadLocalTimesRTree(rapidjson::Document &geojson, std::time_t utc_time);
|
||||
|
||||
Reference in New Issue
Block a user