computer-science
The C++ Standard Library Has Been Walking Itself Back for Fifteen Years
Key takeaways
- Sandor Dargo's post this month on std::copyable_function closes with a quick-reference table.
- The committee spent fifteen years shipping the wrappers that should replace it.
- The C++ committee has been writing that sentence about its own features since C++11 was new.
Sandor Dargo's post this month on std::copyable_function closes with a quick-reference table. Four callable wrappers, one recommendation each, and at the bottom of the list one entry that should stop any working C++ engineer cold:
std::function: Legacy. Avoid in new code.
std::function shipped in C++11. The committee spent fifteen years shipping the wrappers that should replace it. The latest, std::copyable_function, lands in C++26. The recommendation written on top of the new arrival is not "use this when you need a copyable callable." It is "do not use the original."
Article preview — originally published by Hacker News. Full story at the source.
Read full story on Hacker News →
More top stories
Aggregated and edited by the Scoop newsroom. We surface news from Hacker News alongside other reporting so you can compare coverage in one place.
Editorial policy · Corrections · About Scoop