Skip to content

Commit

Permalink
use partition instead
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Zulfaqar Azmi <[email protected]>
  • Loading branch information
zulfaqar-azmi-t4 committed Sep 28, 2023
1 parent c084a1c commit 38e2049
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ void filterObjectsByPosition(
return (-backward_distance < dist_ego_to_obj && dist_ego_to_obj < forward_distance);
};

// Create a new container to hold the filtered objects
PredictedObjects filtered = filterObjects(objects, position_filter);

// Replace the original objects with the filtered list
objects.objects = std::move(filtered.objects);
// Erase objects based on filtered list
objects.objects.erase(
std::partition(objects.objects.begin(), objects.objects.end(), position_filter),
objects.objects.end());
}

void filterObjectsByClass(
Expand All @@ -119,10 +118,10 @@ void filterObjectsByClass(
return isTargetObjectType(object, target_object_types);
};

PredictedObjects filtered_objects = filterObjects(objects, object_class_filter);

// Replace the original objects with the filtered list
objects = std::move(filtered_objects);
// Erase objects based on filtered list
objects.objects.erase(
std::partition(objects.objects.begin(), objects.objects.end(), object_class_filter),
objects.objects.end());
}

std::pair<std::vector<size_t>, std::vector<size_t>> separateObjectIndicesByLanelets(
Expand Down

0 comments on commit 38e2049

Please sign in to comment.