HeadlinesBriefing favicon HeadlinesBriefing.com

C++ Library Reversal Pattern Exposed

Hacker News •
×

The C++ committee has spent fifteen years systematically reversing its own library decisions, creating a pattern of deprecation and replacement that deserves documentation. std::function, introduced in C++11, exemplifies this issue - its const operator() defect has persisted for fifteen years with the committee shipping replacements like std::move_only_function in C++23 and std::copyable_function in C++26 while advising developers to avoid the original.

This pattern extends throughout the standard library's history. Formal walk-backs include std::auto_ptr (removed in C++17), dynamic exception specifications, and the C++11 garbage collection interface which was added and removed without ever functioning. The committee has also rejected multiple Technical Specifications, including the Reflection TS entirely.

Perhaps most troubling are features like std::regex that remain in the standard despite documented performance issues. The committee acknowledges std::regex is "very poor relative to other available solutions" yet remains the default in tutorials. This creates a stark divide between the standard library and production codebases that consistently work around library defects.