How to Implement the C++ Standard Library (Part 2): An Excursion into libc++
summary
Live demo implements ranges::fold_right inside libc++ by adding tests, a new header, CMake entry and a function object; uses LLVM/Clang checkout, CMake, ninja + lit to build and run tests. Encounters and fixes real bugs (missing const on operator(), return-type deduction, iterator decrement loop), shows why std::invoke is needed, discusses symbol visibility/hidden-ABI macros, and notes the surprising numeric behavior of left vs right folds with subtraction. Core implementation compiles and most tests pass, but full test coverage remains unfinished.
AI-written summary · about
chapters (9)
- 0:00Implementing C++ Standard Library
- 1:15libc++ contributions start
- 6:41libc++ in VS Code
- 17:31libc++ namespace and headers
- 23:41Fold right in libc++
- 29:19CMake build libC++
- 31:32Run lit tests debug
- 43:01Symbol hiding and ABI
- 58:29Summary
related talks
01h 29mWhat Does It Take to Implement the C++ Standard Library?
01h 01mFrom STL to Ranges: Using Ranges Effectively
59mModern C++ for Fun and Profit: This isn’t your old C++
46mMeandering Through C++ Creating ranges::to
57mSome Things C++ Does Right
01h 15mHow to Rangify Your Code
05mBeautiful Folds
01h 02mC++20 Ranges in Practice
