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

Anthropic S-1
SiNTEx · Hacker News · 1d ago
Police are using AI to pull over drivers for 'suspicious' behavior
gumby · Hacker News · 11h ago
Python's experimental JIT to be removed
f311a · Hacker News · 17h ago
Solar power is becoming bigger than nuclear
geox · Hacker News · 1d ago
The Exponential Time Hypothesis Is False [pdf]
vok · Hacker News · 1d ago