C++ Links #6: C++23 Progress, Command Line, Containers, and more!
Welcome to the 6th episode of C++ Links available for C++ Stories subscribers.
See the best C++ stories from the past month.
Here’s the plan for today:
- C++23 progress
- Parsing Command Line Arguments
- 3 New articles at C++stories in November
- + 8 Hot C++ News
- How to write a custom iterator in C++20
- Read till the end to see an additional bonus :)
🚧 C++23 ISO Progress
At the end of October, there was a cool episode at C++ Cast with Bryce Adelstein Lelbach about the progress of C++23.
- Everything is moving to Clang - is that good? It’s now lagging with the latest C++ features, probably because of its growth. In GCC, they started using C++ for the compiler, so it looks like it speeds up things.
- Networking has no consensus - TS is probably not worth putting into the Standard with its current state. Networking TS is also based on the ASIO model, and that can conflict with other features related to async. Do we need to have a single model for async processing?
- And last year it appeared that this will not going to work.* Executors - they started a long time ago, and at some point, it grew too much and became too complicated to maintain. But another proposal on sender receivers came out that can be more practical and better adjusted for companies like NVidia.
- The main issue is that the Committee spends a lot of time on almost philosophical discussions about the underlying model.
- Networking TS also doesn’t have a security layer, and there’s a question if we should have Networking with it or not (as a custom-built thing).
- Security issues might involve ABI changes in the future, so that’s a hot topic :)
- ABI changes: nothing has changed in the Committee, so we’re deadlocked now.
- Networking TS is 400 pages, and it requires a lot of time to review it and redesign it now
- what did make in C++23: ranges fixes, formatting, standard library module (one big module), maybe finer gained modules might come later, std::generator - for coroutines (hopefully), md span, std::expected!, deducing this, constexpr class, a little bit larger than C++14
- Because of the pandemic, it made things slower, it’s not that bad, but they could ship more with face-to-face meetings. The meeting in February is already canceled, so it’s not clear if there will be a live meeting mid-next year.
- No reflection in C++23, also no pattern matching, no contracts
Listed no the whole episode here: C++23 ISO Progress @C++Cast
If you want more updates, you can also look at this detailed post at reddit/r/cpp about C++23 with links and descriptions of proposals that might be or not in the Standard. » C++23: Near The Finish Line r/cpp
🛠️ Parsing Command Line Arguments
A practical article that describes the following approaches:
- A “quick-and-dirty” method - it’s a hacked version where you assume some special order of parameters.
- Extending the basic approach - wrapping code in a separate namespace, extending the handlers, making it more generic.
- Adding some third-party libraries - the author describes basic examples for boost::program_options, GNU getopt, cxxopts
See the full text: » 3 Ways To Parse Command Line Arguments in C++: Quick, Do-It-Yourself, Or Comprehensive @mostsignificant
ℹ️ Three New Articles at C++Stories in Nov
Here are the recent changes on the C++ Stories website that happened in November 2021:
- 6 More Ways to Refactor new/delete into unique ptr - In the first part of the series, we covered (smart) pointers inside a function body; in the second part, I showed cases for return types, data members, and a few others.
- C++20: Heterogeneous Lookup in (Un)ordered Containers] - Would you like to gain 20…35 or even 50% speed improvements when searching in associative containers? In this blog post, we’ll explore a technique called “heterogenous access” that offers such impressive speedups. We’ll explore ordered containers and the support for unordered collections added recently in C++20.
- Designated Initializers in C++20 - New Standard, new ways to initialize objects! With C++20, we get a handy way of initializing data members. The new feature is called designated initializers and might be familiar to C programmers.
🎁 Would you like to join the PREMIUM version?
Enjoy special promotions for November and December!
In the Premium newsletter, you’ll get the following:
- Weekly, instead of once per month
- Summaries of selected articles and presentations, notes, and core points
- This month:
- Notes from Fireside Chat Panel @Cpp Con
- Notes from the presentation Value in a Procedural World by Lisa Lippincott
- Notes from the CppCon 2021 keynote C++20: Reaching for the Aims of C++ by Bjarne Stroustrup
- Notes from “C++23 Standard Library Preview” by Jeff Garland from Meeting C++ 2021
- and more!
- This month:
- Dedicated Discord server for discussions
- Bonus Articles (the Updated plan) - usually 2x per month!
- Archives and access to all previous posts (~two years of content!)
- No ads or sponsored messages
You have two options:
- Basic tier (weekly news, free ebooks, selected bonus articles, ref card): 3$ per month, or 30$ per year (-16%)
- Know & Learn tier: (same as Basic + more bonus articles, previews, and more): 5$ per month or 50$ per year (-16%)
The membership is supported through the Patreon Platform,
Join here: Join C++ Stories @Patreon
(Or see all the benefits here - C++ Stories Membership)
🌐 Quick C++ Links
Hot news and valuable links that I found in November:
Don’t reopen namespace std Arthur O’Dwyer makes some good points about this technique. The first one is that it’s cleaner and simpler just to specify the full name. More importantly, the name lookup inside namespace std works differently (so you might be occasionally hit by some name clashes).
And more article(s) from Arthur, check your knowledge!
Overload arrangement puzzles This time it’s a quiz that he shared at CppCon. Arthur also shared C++ Pub Quiz 1 and C++ Pub Quiz 2.
Visual Studio 2022 @CppCast A new episode with Sy Brand. They spoke about recent C++ conferences and the new features of Visual Studio 2022. You can read the full release note for this excellent product here: Visual Studio 2022 Preview Release Notes @Microsoft Docs. 64-bits, hot reload and more cool features.
What’s new for C++ cross-platform developers in VS 2022 @C++ Team Blog A short video (~20 min) about features like CMake integration, Managing dependencies with a vcpkg, coding and debugging a Linux GUI app with WSL 2 or Debugging a remote process with LLDB .
Photoshop’s journey to the web Thanks to Emscripten and WebAsm, Adobe managed to push their amazing software to the browser!
Making Super Mario Bros using C++ and SFML - SFML Tutorial @YouTube Another fun video! This time about Mario Bros and also restricted to only 8 minutes. Rendering, collisions, movement, even Goombas and animations.
A Close Look at a Spinlock – Embedded in Academia An interesting article about the internals of a spinlock. How to make it efficient, so it works fast but also doesn’t burn too much CPU?
Virtual inheritance in C++ Marius Bancila discusses options to solve the diamond inheritance problem. This article also contains cool and detailed diagrams of mem layout for structures used in examples.
🗑️ Writing a custom iterator (Patreon Extra)
In November, I created two articles about implementing a custom iterator for a container: vector of vectors. It’s based on a popular interview question. I extended it and ported it into C++20 :)
Even in such a relatively simple project, I could use some cool new C++20 features that make code even cleaner: for example, “down with typename!” and also “rules for rewriting operators”.
See here @Patreon: Part one and Part Two
See the list of other articles (37!) on this page: Bonus Articles@C++Stories some of them require 5$+ tier, but recently I extended it also just to the 3$ Tier
What was your favorite news/article/presentation that you saw in November? What’s on your mind related to C++?
Share your feedback in the comments below this text.
I've prepared a valuable bonus if you're interested in Modern C++!
Learn all major features of recent C++ Standards!
Check it out here: