auto dis_calculator =
std::bind(&LaneTrackerImpl::calc_lane_distance, this,
std::placeholders::_1, std::placeholders::_2, false, 0.0f,
std::placeholders::_3, std::placeholders::_4,
std::placeholders::_5, std::placeholders::_6);我像这样写代码:
auto lane_distance_calculator = [this](const Lane &lane1, const Lane &lane2,
bool disable_lane_start_distance_affection,
bool disable_lane_end_distance_affection,
DistanceMethod method, bool is_matching_phase)
{
this->calc_lane_distance(
lane1, lane2, false, 0.0f,
disable_lane_start_distance_affection,
disable_lane_end_distance_affection,
method, is_matching_phase);
};func merge_lanes使用它:
merge_lanes(prob_thresh_list_, detected_lanes.lanes, tracked_lanes.lanes,
result.lanes, next_track_id, detection_score_threshold_,
lane_distance_calculator); 错误:
error: no matching function for call to ‘{anonymous}::LaneTrackerImpl::merge_lanes(std::vector<float, std::allocator<float> >&, std::vector<perception::Lane>&, std::vector<perception::Lane>&, std::vector<perception::Lane>&, size_t&, float&, {anonymous}::LaneTrackerImpl::merge(perception::LanePrediction&, perception::LanePrediction&, size_t)::<lambda(const perception::Lane&, const perception::Lane&, bool, bool, {anonymous}::LaneTrackerImpl::DistanceMethod, bool)>&)’
lane_distance_calculator);我该怎么解决它呢?这让我困惑了很长时间。
发布于 2021-05-15 01:55:37
你已经很接近了。试着这样做:
auto dis_calculator = [this](const Lane &lane1, const Lane &lane2,
bool disable_lane_start_distance_affection,
bool disable_lane_end_distance_affection,
DistanceMethod method, bool is_matching_phase)
{
this->calc_lane_distance(
lane1, lane2, false, 0.0f,
disable_lane_start_distance_affection,
disable_lane_end_distance_affection,
method, is_matching_phase);
};https://stackoverflow.com/questions/67536296
复制相似问题