Skip to content

Commit 4db120b

Browse files
committed
Limit Request type by concept idiom for make function in field_operator_application.cpp
1 parent d6b9e0e commit 4db120b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

external/concealer/src/field_operator_application.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,11 @@ auto FieldOperatorApplication::plan(
371371
plan(route.back().pose, waypoints, route_option);
372372
}
373373

374-
template <typename Request, typename Waypoint>
374+
template <
375+
typename Request, typename Waypoint,
376+
typename = std::enable_if_t<
377+
std::is_same_v<Request, autoware_adapi_v1_msgs::srv::SetRoutePoints::Request> ||
378+
std::is_same_v<Request, autoware_adapi_v1_msgs::srv::SetRoute::Request> > >
375379
static auto make(
376380
const geometry_msgs::msg::Pose & goal, const std::vector<Waypoint> & waypoints,
377381
const FieldOperatorApplication::RouteOption & option) -> std::shared_ptr<Request>
@@ -389,11 +393,6 @@ static auto make(
389393
for (const auto & waypoint : waypoints) {
390394
request->segments.push_back(waypoint);
391395
}
392-
} else {
393-
std::stringstream what;
394-
what << "Unsupported type of Request for make in" << __FILE__ << " : " << typeid(Request).name()
395-
<< ". autoware_adapi_v1_msgs::srv::SetRoutePoints::Request expected.";
396-
throw common::Error(what.str());
397396
}
398397

399398
/*

0 commit comments

Comments
 (0)