Replace boost::optional with std::optional (#6611)
This commit is contained in:
@@ -66,7 +66,7 @@ SelectRoadByNameOnlyChoiceAndStraightness::SelectRoadByNameOnlyChoiceAndStraight
|
||||
{
|
||||
}
|
||||
|
||||
boost::optional<EdgeID> SelectRoadByNameOnlyChoiceAndStraightness::operator()(
|
||||
std::optional<EdgeID> SelectRoadByNameOnlyChoiceAndStraightness::operator()(
|
||||
const NodeID /*nid*/,
|
||||
const EdgeID /*via_edge_id*/,
|
||||
const IntersectionView &intersection,
|
||||
@@ -118,7 +118,7 @@ SelectStraightmostRoadByNameAndOnlyChoice::SelectStraightmostRoadByNameAndOnlyCh
|
||||
{
|
||||
}
|
||||
|
||||
boost::optional<EdgeID> SelectStraightmostRoadByNameAndOnlyChoice::operator()(
|
||||
std::optional<EdgeID> SelectStraightmostRoadByNameAndOnlyChoice::operator()(
|
||||
const NodeID /*nid*/,
|
||||
const EdgeID /*via_edge_id*/,
|
||||
const IntersectionView &intersection,
|
||||
@@ -241,7 +241,7 @@ boost::optional<EdgeID> SelectStraightmostRoadByNameAndOnlyChoice::operator()(
|
||||
return {};
|
||||
}
|
||||
|
||||
return is_only_choice_with_same_name ? boost::optional<EdgeID>(min_element->eid) : boost::none;
|
||||
return is_only_choice_with_same_name ? std::optional<EdgeID>(min_element->eid) : std::nullopt;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "extractor/maneuver_override_relation_parser.hpp"
|
||||
#include "extractor/maneuver_override.hpp"
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <osmium/osm.hpp>
|
||||
#include <osmium/tags/filter.hpp>
|
||||
#include <osmium/tags/taglist.hpp>
|
||||
@@ -21,7 +21,7 @@ ManeuverOverrideRelationParser::ManeuverOverrideRelationParser() {}
|
||||
* into an InputManeuverOverride object, if the relation is considered
|
||||
* valid (i.e. has the minimum tags we expect).
|
||||
*/
|
||||
boost::optional<InputManeuverOverride>
|
||||
std::optional<InputManeuverOverride>
|
||||
ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
||||
if (osmium::tags::match_none_of(tag_list, filter))
|
||||
// if it's not a maneuver, continue;
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// we pretend every restriction is a conditional restriction. If we do not find any restriction,
|
||||
@@ -130,7 +130,7 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
|
||||
}
|
||||
else
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
return maneuver_override;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ void IntersectionHandler::assignTrivialTurns(const EdgeID via_eid,
|
||||
}
|
||||
}
|
||||
|
||||
boost::optional<IntersectionHandler::IntersectionViewAndNode>
|
||||
std::optional<IntersectionHandler::IntersectionViewAndNode>
|
||||
IntersectionHandler::getNextIntersection(const NodeID at, const EdgeID via) const
|
||||
{
|
||||
// We use the intersection generator to jump over traffic signals, barriers. The intersection
|
||||
@@ -450,7 +450,7 @@ IntersectionHandler::getNextIntersection(const NodeID at, const EdgeID via) cons
|
||||
if (intersection_parameters.node == SPECIAL_NODEID ||
|
||||
intersection_parameters.edge == SPECIAL_EDGEID)
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto intersection = extractor::intersection::getConnectedRoads<false>(node_based_graph,
|
||||
@@ -465,11 +465,10 @@ IntersectionHandler::getNextIntersection(const NodeID at, const EdgeID via) cons
|
||||
|
||||
if (intersection.size() <= 2 || intersection.isTrafficSignalOrBarrier())
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return boost::make_optional(
|
||||
IntersectionViewAndNode{std::move(intersection), intersection_node});
|
||||
return std::make_optional(IntersectionViewAndNode{std::move(intersection), intersection_node});
|
||||
}
|
||||
|
||||
bool IntersectionHandler::isSameName(const EdgeID source_edge_id, const EdgeID target_edge_id) const
|
||||
|
||||
@@ -634,7 +634,7 @@ Intersection SliproadHandler::operator()(const NodeID /*nid*/,
|
||||
|
||||
// Implementation details
|
||||
|
||||
boost::optional<std::size_t> SliproadHandler::getObviousIndexWithSliproads(
|
||||
std::optional<std::size_t> SliproadHandler::getObviousIndexWithSliproads(
|
||||
const EdgeID from, const Intersection &intersection, const NodeID at) const
|
||||
{
|
||||
BOOST_ASSERT(from != SPECIAL_EDGEID);
|
||||
@@ -645,14 +645,14 @@ boost::optional<std::size_t> SliproadHandler::getObviousIndexWithSliproads(
|
||||
|
||||
if (index != 0)
|
||||
{
|
||||
return boost::make_optional(index);
|
||||
return std::make_optional(index);
|
||||
}
|
||||
|
||||
// Otherwise check if the road is forking into two and one of them is a Sliproad;
|
||||
// then the non-Sliproad is the obvious one.
|
||||
if (intersection.size() != 3)
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto forking = intersection[1].instruction.type == TurnType::Fork &&
|
||||
@@ -660,7 +660,7 @@ boost::optional<std::size_t> SliproadHandler::getObviousIndexWithSliproads(
|
||||
|
||||
if (!forking)
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto first = getNextIntersection(at, intersection.getRightmostRoad().eid);
|
||||
@@ -668,27 +668,27 @@ boost::optional<std::size_t> SliproadHandler::getObviousIndexWithSliproads(
|
||||
|
||||
if (!first || !second)
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (first->intersection.isDeadEnd() || second->intersection.isDeadEnd())
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// In case of loops at the end of the road, we will arrive back at the intersection
|
||||
// itself. If that is the case, the road is obviously not a sliproad.
|
||||
if (canBeTargetOfSliproad(first->intersection) && at != second->node)
|
||||
{
|
||||
return boost::make_optional(std::size_t{2});
|
||||
return std::make_optional(std::size_t{2});
|
||||
}
|
||||
|
||||
if (canBeTargetOfSliproad(second->intersection) && at != first->node)
|
||||
{
|
||||
return boost::make_optional(std::size_t{1});
|
||||
return std::make_optional(std::size_t{1});
|
||||
}
|
||||
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool SliproadHandler::nextIntersectionIsTooFarAway(const NodeID start, const EdgeID onto) const
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
using osrm::util::angularDeviation;
|
||||
|
||||
@@ -590,7 +590,7 @@ Intersection TurnHandler::assignRightTurns(const EdgeID via_edge,
|
||||
}
|
||||
|
||||
// finds a fork candidate by just looking at the geometry and angle of an intersection
|
||||
boost::optional<TurnHandler::Fork>
|
||||
std::optional<TurnHandler::Fork>
|
||||
TurnHandler::findForkCandidatesByGeometry(Intersection &intersection) const
|
||||
{
|
||||
if (intersection.size() >= 3)
|
||||
@@ -647,7 +647,7 @@ TurnHandler::findForkCandidatesByGeometry(Intersection &intersection) const
|
||||
}
|
||||
}
|
||||
}
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// check if the fork candidates (all roads between left and right) and the
|
||||
@@ -695,8 +695,8 @@ bool TurnHandler::isCompatibleByRoadClass(const Intersection &intersection, cons
|
||||
|
||||
// Checks whether a three-way-intersection coming from `via_edge` is a fork
|
||||
// with `intersection` as described as in #IntersectionExplanation@intersection_handler.hpp
|
||||
boost::optional<TurnHandler::Fork> TurnHandler::findFork(const EdgeID via_edge,
|
||||
Intersection &intersection) const
|
||||
std::optional<TurnHandler::Fork> TurnHandler::findFork(const EdgeID via_edge,
|
||||
Intersection &intersection) const
|
||||
{
|
||||
auto fork = findForkCandidatesByGeometry(intersection);
|
||||
if (fork)
|
||||
@@ -740,7 +740,7 @@ boost::optional<TurnHandler::Fork> TurnHandler::findFork(const EdgeID via_edge,
|
||||
}
|
||||
}
|
||||
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
namespace osrm::util::coordinate_calculation
|
||||
@@ -173,14 +174,14 @@ double computeAngle(const Coordinate first, const Coordinate second, const Coord
|
||||
return angle;
|
||||
}
|
||||
|
||||
boost::optional<Coordinate>
|
||||
std::optional<Coordinate>
|
||||
circleCenter(const Coordinate C1, const Coordinate C2, const Coordinate C3)
|
||||
{
|
||||
// free after http://paulbourke.net/geometry/circlesphere/
|
||||
// require three distinct points
|
||||
if (C1 == C2 || C2 == C3 || C1 == C3)
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// define line through c1, c2 and c2,c3
|
||||
@@ -195,7 +196,7 @@ circleCenter(const Coordinate C1, const Coordinate C2, const Coordinate C3)
|
||||
(std::abs(C2C1_lat) < std::numeric_limits<double>::epsilon() &&
|
||||
std::abs(C3C2_lat) < std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
else if (std::abs(C2C1_lon) < std::numeric_limits<double>::epsilon())
|
||||
{
|
||||
@@ -233,7 +234,7 @@ circleCenter(const Coordinate C1, const Coordinate C2, const Coordinate C3)
|
||||
|
||||
// can this ever happen?
|
||||
if (std::abs(C2C1_slope - C3C2_slope) < std::numeric_limits<double>::epsilon())
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
|
||||
const double C1_y = static_cast<double>(toFloating(C1.lat));
|
||||
const double C1_x = static_cast<double>(toFloating(C1.lon));
|
||||
@@ -247,7 +248,7 @@ circleCenter(const Coordinate C1, const Coordinate C2, const Coordinate C3)
|
||||
(2 * (C3C2_slope - C2C1_slope));
|
||||
const double lat = (0.5 * (C1_x + C2_x) - lon) / C2C1_slope + 0.5 * (C1_y + C2_y);
|
||||
if (lon < -180.0 || lon > 180.0 || lat < -90.0 || lat > 90.0)
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
else
|
||||
return Coordinate(FloatLongitude{lon}, FloatLatitude{lat});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ NodeIdVectorToLineString::NodeIdVectorToLineString(
|
||||
// converts a vector of node ids into a linestring geojson feature
|
||||
util::json::Object
|
||||
NodeIdVectorToLineString::operator()(const std::vector<NodeID> &node_ids,
|
||||
const boost::optional<json::Object> &properties) const
|
||||
const std::optional<json::Object> &properties) const
|
||||
{
|
||||
util::json::Array coordinates;
|
||||
std::transform(node_ids.begin(),
|
||||
@@ -37,7 +37,7 @@ NodeIdVectorToMultiPoint::NodeIdVectorToMultiPoint(
|
||||
|
||||
util::json::Object
|
||||
NodeIdVectorToMultiPoint::operator()(const std::vector<NodeID> &node_ids,
|
||||
const boost::optional<json::Object> &properties) const
|
||||
const std::optional<json::Object> &properties) const
|
||||
{
|
||||
util::json::Array coordinates;
|
||||
std::transform(node_ids.begin(),
|
||||
@@ -51,7 +51,7 @@ NodeIdVectorToMultiPoint::operator()(const std::vector<NodeID> &node_ids,
|
||||
//----------------------------------------------------------------
|
||||
util::json::Object
|
||||
CoordinateVectorToMultiPoint::operator()(const std::vector<util::Coordinate> &input_coordinates,
|
||||
const boost::optional<json::Object> &properties) const
|
||||
const std::optional<json::Object> &properties) const
|
||||
{
|
||||
auto coordinates = makeJsonArray(input_coordinates);
|
||||
return makeFeature("MultiPoint", std::move(coordinates), properties);
|
||||
@@ -60,7 +60,7 @@ CoordinateVectorToMultiPoint::operator()(const std::vector<util::Coordinate> &in
|
||||
//----------------------------------------------------------------
|
||||
util::json::Object
|
||||
CoordinateVectorToLineString::operator()(const std::vector<util::Coordinate> &input_coordinates,
|
||||
const boost::optional<json::Object> &properties) const
|
||||
const std::optional<json::Object> &properties) const
|
||||
{
|
||||
auto coordinates = makeJsonArray(input_coordinates);
|
||||
return makeFeature("LineString", std::move(coordinates), properties);
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -158,7 +158,7 @@ void Timezoner::LoadLocalTimesRTree(rapidjson::Document &geojson, std::time_t ut
|
||||
rtree = rtree_t(polygons);
|
||||
}
|
||||
|
||||
boost::optional<struct tm> Timezoner::operator()(const point_t &point) const
|
||||
std::optional<struct tm> Timezoner::operator()(const point_t &point) const
|
||||
{
|
||||
std::vector<rtree_t::value_type> result;
|
||||
rtree.query(boost::geometry::index::intersects(point), std::back_inserter(result));
|
||||
@@ -168,6 +168,6 @@ boost::optional<struct tm> Timezoner::operator()(const point_t &point) const
|
||||
if (boost::geometry::within(point, local_times[index].first))
|
||||
return local_times[index].second;
|
||||
}
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
} // namespace osrm::updater
|
||||
|
||||
Reference in New Issue
Block a user