Get rid of boost::optional leftovers (#6977)
This commit is contained in:
committed by
GitHub
parent
d0ed29adb7
commit
57b792c768
@@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "engine/hint.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@@ -74,12 +74,12 @@ struct BaseParameters
|
||||
};
|
||||
|
||||
std::vector<util::Coordinate> coordinates;
|
||||
std::vector<boost::optional<Hint>> hints;
|
||||
std::vector<boost::optional<double>> radiuses;
|
||||
std::vector<boost::optional<Bearing>> bearings;
|
||||
std::vector<boost::optional<Approach>> approaches;
|
||||
std::vector<std::optional<Hint>> hints;
|
||||
std::vector<std::optional<double>> radiuses;
|
||||
std::vector<std::optional<Bearing>> bearings;
|
||||
std::vector<std::optional<Approach>> approaches;
|
||||
std::vector<std::string> exclude;
|
||||
boost::optional<OutputFormatType> format = OutputFormatType::JSON;
|
||||
std::optional<OutputFormatType> format = OutputFormatType::JSON;
|
||||
|
||||
// Adds hints to response which can be included in subsequent requests, see `hints` above.
|
||||
bool generate_hints = true;
|
||||
@@ -90,10 +90,10 @@ struct BaseParameters
|
||||
SnappingType snapping = SnappingType::Default;
|
||||
|
||||
BaseParameters(std::vector<util::Coordinate> coordinates_ = {},
|
||||
std::vector<boost::optional<Hint>> hints_ = {},
|
||||
std::vector<boost::optional<double>> radiuses_ = {},
|
||||
std::vector<boost::optional<Bearing>> bearings_ = {},
|
||||
std::vector<boost::optional<Approach>> approaches_ = {},
|
||||
std::vector<std::optional<Hint>> hints_ = {},
|
||||
std::vector<std::optional<double>> radiuses_ = {},
|
||||
std::vector<std::optional<Bearing>> bearings_ = {},
|
||||
std::vector<std::optional<Approach>> approaches_ = {},
|
||||
bool generate_hints_ = true,
|
||||
std::vector<std::string> exclude = {},
|
||||
const SnappingType snapping_ = SnappingType::Default)
|
||||
@@ -112,7 +112,7 @@ struct BaseParameters
|
||||
(approaches.empty() || approaches.size() == coordinates.size()) &&
|
||||
std::all_of(bearings.begin(),
|
||||
bearings.end(),
|
||||
[](const boost::optional<Bearing> &bearing_and_range)
|
||||
[](const std::optional<Bearing> &bearing_and_range)
|
||||
{
|
||||
if (bearing_and_range)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
@@ -90,7 +90,7 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
|
||||
|
||||
util::json::Object makeRoute(const guidance::Route &route,
|
||||
util::json::Array legs,
|
||||
boost::optional<util::json::Value> geometry,
|
||||
std::optional<util::json::Value> geometry,
|
||||
const char *weight_name);
|
||||
|
||||
// Creates a Waypoint without Hint, see the Hint overload below
|
||||
|
||||
@@ -45,7 +45,7 @@ class NearestAPI final : public BaseAPI
|
||||
flatbuffers::FlatBufferBuilder &fb_result) const
|
||||
{
|
||||
auto data_timestamp = facade.GetTimestamp();
|
||||
boost::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none;
|
||||
std::optional<flatbuffers::Offset<flatbuffers::String>> data_version_string = std::nullopt;
|
||||
if (!data_timestamp.empty())
|
||||
{
|
||||
data_version_string = fb_result.CreateString(data_timestamp);
|
||||
|
||||
@@ -184,10 +184,10 @@ class RouteAPI : public BaseAPI
|
||||
return builder.CreateVectorOfStructs(coordinates);
|
||||
}
|
||||
|
||||
boost::optional<util::json::Value>
|
||||
MakeGeometry(boost::optional<std::vector<Coordinate>> &&annotations) const
|
||||
std::optional<util::json::Value>
|
||||
MakeGeometry(std::optional<std::vector<Coordinate>> &&annotations) const
|
||||
{
|
||||
boost::optional<util::json::Value> json_geometry;
|
||||
std::optional<util::json::Value> json_geometry;
|
||||
if (annotations)
|
||||
{
|
||||
auto begin = annotations->begin();
|
||||
@@ -720,8 +720,7 @@ class RouteAPI : public BaseAPI
|
||||
std::vector<guidance::LegGeometry> &leg_geometries = legs_info.second;
|
||||
|
||||
auto route = guidance::assembleRoute(legs);
|
||||
boost::optional<util::json::Value> json_overview =
|
||||
MakeGeometry(MakeOverview(leg_geometries));
|
||||
std::optional<util::json::Value> json_overview = MakeGeometry(MakeOverview(leg_geometries));
|
||||
|
||||
std::vector<util::json::Value> step_geometries;
|
||||
const auto total_step_count =
|
||||
@@ -997,10 +996,10 @@ class RouteAPI : public BaseAPI
|
||||
return result;
|
||||
}
|
||||
|
||||
boost::optional<std::vector<Coordinate>>
|
||||
std::optional<std::vector<Coordinate>>
|
||||
MakeOverview(const std::vector<guidance::LegGeometry> &leg_geometries) const
|
||||
{
|
||||
boost::optional<std::vector<Coordinate>> overview;
|
||||
std::optional<std::vector<Coordinate>> overview;
|
||||
if (parameters.overview != RouteParameters::OverviewType::False)
|
||||
{
|
||||
const auto use_simplification =
|
||||
|
||||
@@ -82,7 +82,7 @@ struct RouteParameters : public BaseParameters
|
||||
const bool alternatives_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
const std::optional<bool> continue_straight_,
|
||||
Args &&...args_)
|
||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
||||
// below.
|
||||
@@ -100,7 +100,7 @@ struct RouteParameters : public BaseParameters
|
||||
const bool annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
const std::optional<bool> continue_straight_,
|
||||
Args &&...args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
|
||||
@@ -118,7 +118,7 @@ struct RouteParameters : public BaseParameters
|
||||
const AnnotationsType annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
const std::optional<bool> continue_straight_,
|
||||
Args &&...args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||
@@ -135,7 +135,7 @@ struct RouteParameters : public BaseParameters
|
||||
const bool annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
const std::optional<bool> continue_straight_,
|
||||
std::vector<std::size_t> waypoints_,
|
||||
const Args &&...args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
@@ -153,7 +153,7 @@ struct RouteParameters : public BaseParameters
|
||||
const AnnotationsType annotations_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
const std::optional<bool> continue_straight_,
|
||||
std::vector<std::size_t> waypoints_,
|
||||
Args &&...args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
@@ -172,7 +172,7 @@ struct RouteParameters : public BaseParameters
|
||||
AnnotationsType annotations_type = AnnotationsType::None;
|
||||
GeometriesType geometries = GeometriesType::Polyline;
|
||||
OverviewType overview = OverviewType::Simplified;
|
||||
boost::optional<bool> continue_straight;
|
||||
std::optional<bool> continue_straight;
|
||||
std::vector<std::size_t> waypoints;
|
||||
|
||||
bool IsValid() const
|
||||
|
||||
@@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "engine/api/route_parameters.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm::engine::api
|
||||
|
||||
Reference in New Issue
Block a user