Interconverting std::function with copyable_function

·Hacker News··

C++11 introduced std::function as a type-erased callable-object holder. function was badly designed in a few ways: Its rarely used “go fish” API bloats every user; it advertises operator() const even when the controlled object’s operator() is mutating; it handles what should be a precondition violation by throwing an exception, which again bloats every user and means its operator() can never be noexcept. So C++26 fixed these problems by adding std::copyable_function. (Which preserves some of fun

Read full article →

Related Articles

google.com/goto: Google's anti-scraping update
1e1a · Hacker News · 23h ago
Will There Be a 7G?
Betelbuddy · Hacker News · 10h ago
Navier-Stokes Announcement
rvz · Hacker News · 22h ago
Real-SWE: Benchmarking AI models on private, real-world, enterprise codebases
theanonymousone · Hacker News · 6h ago
Linux Zoom client proactively reading everything written to X11 clipboard
encyclopedism · Hacker News · 8h ago