Prefer lambda to std::bind
Open
Nobody has claimed this yet.
help wanted
question
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
Feature description
Replace all std::bind with lambda. Is it worth doing it for now?
https://github.com/isocpp/CppCoreGuidelines/issues/1796
Implementation considerations
e.g.
parameter_subscription_ = rclcpp::AsyncParametersClient::on_parameter_event(
node_topics_,
[this](std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event) {
return on_parameter_event(event);
}
);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rclcpp/src/rclcpp/time_source.cpp around lines 130-133, then inventory the other std::bind uses in rclcpp and check whether each replacement preserves its callback behavior. Done means all intended std::bind calls are replaced with equivalent lambdas and the existing rclcpp tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100