cpp_weekly
cpp_weekly copied to clipboard
The official C++ Weekly Repository. Code samples and notes of future / past episodes will land here at various times. PR's will be accepted in some cases.
A comparison of the monadic call chain interface from std::optional in C++23 and using exceptions to handle error cases instead.
**Channel** C++Weekly **Topics** lower_bound, branchless programming, performance, cmov **Length** 10-20 I've profiled this myself and found that it is consistently faster than std::lower_bound (from libstdc++) using either clang or gcc,...
**Channel** C++Weekly **Topics** Scope guards, aka scope_exit, scope_success, scope_fail and unique_resource. This could be in relation to Alexandrescu's book. Also what exactly is the library fundamentals v3? **Length** I think...
**Channel** C++ Weekly **Topics** Data Oriented Design coupled with the STL **Length** 10-20
**Channel** "C++Weekly" **Topics** C++23's new `std::ranges::fold_*` algorithms **Length** Not sure
**Channel** This is a C++ Weekly episode request. **Topics** Inheriting from `std::variant`, as shown in [this](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2162r0.html) proposal. This allows one to write state machines such as: ```cpp struct State :...
**Channel** C++Weekly **Topics** What are the practical differences between std::accumulate, std::reduce, std::ranges::fold_left, std::ranges::fold_right and any other similar algorithms or ways to compute a result from a range, sequence,.or container. **Length**...
**C++Weekly** **Topics** I've just found that this code compiles on GCC 10.4 but does not on GCC 11.1: ```cpp #include int main() { std::optional blah; } ``` Proof: https://godbolt.org/z/nn3vYG494 The...
**Channel** This is a "C++Weekly" episode request **Topics** What's wrong with the following code? ```cpp class Keeper { std::vector m_Data {1,2,3}; public: auto& items() { return m_Data; } }; Keeper...
**Channel** C++Weekly **Topics** 1. user-defined literals that require both a template and a non-template arguments 2. compile-time initializers for embedded devices' code 3. low-level memory layout to adhere to external...