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

Document-borne AI worms can self-propagate through Copilot for Word
Canopy9560 · Hacker News · 13h ago
AI's top startups are barely publishing their research
YeGoblynQueenne · Hacker News · 4h ago
Handbook.md shows that long policy documents do not reliably govern agents
spIrr · Hacker News · 12h ago
Keychron announces first open-source firmware for gaming mice
JLO64 · Hacker News · 8h ago
Turning a dumb AC unit smart (without losing my security deposit)
austinallegro · Hacker News · 7h ago