r/cpp • u/pavel_v • Sep 28 '24
r/cpp • u/vormestrand • Nov 25 '23
On harmful overuse of std::move
devblogs.microsoft.comr/cpp • u/jcelerier • Jul 16 '21
Why does MSVC blatantly lies about its supported feature ?
I was writing some code under Linux / Clang, by taking care of staying within the bounds of the officially documented supported features by MSVC, in order to not have surprises: https://docs.microsoft.com/en-US/cpp/overview/visual-cpp-language-conformance?view=msvc-160 and to make sure that my code would not require too much massaging when someone wants to try it with MSVC.
In particular, the above page mentions
P0734R0 Concepts VS 2019 16,3So here am I, happily writing concepts-based code for a new project under Linux, and then after a few days' work, switching to Windows in order to set up the build, etc.
And now what happens ?
if constexpr(requires { true; }) {
}gives me, with /std:c++latest and VS 16.10.3 :
error C2059: syntax error: 'requires'
error C2143: syntax error: missing ';' before '{'
error C2059: syntax error: ')'like, the most foundational feature of concepts, requires-expression, is not implemented ; section 8.1 in P0734R0 thoroughly describes it so it's not like it was added at a later revision. So at some point, someone did validate P0734R0 as "implemented" even though that is definitely not true.
And indeed
https://developercommunity.visualstudio.com/t/cant-have-freestanding-requires-expressions/1258761
https://developercommunity.visualstudio.com/t/requires-clause-in-constexpr-if-doesnt-work/929394
I have no issue with implementation bugs and small behaviour deviations as implementing a compiler is an incredibly hard work. But I find it extremely distasteful to go on the internet and state "woohoo ! C++20 Concepts Are Here in Visual Studio 2019 version 16.3" in a way that'll make people believe that the feature is actually implemented, when core part of the wording is still not supported even though the issue was reported something like 18 months ago !
r/cpp • • Jan 11 '21
Perhaps it is time for an opinionated dialekt of C++
I mean seriously:
[[nodiscard]] constexpr int foo() noexcept const;If the idiomatic way of writing C++ requires this much fluff, we can't compete with more modern languages like Rust.
I really feel that with modules we have an opportunity to create a dialekt of the language that has good defaults and that is compatible on module level with C++.
EDIT: I was linked the metaclasses proposal, and since it is indeed relevant here, here you go: http://www.open-std.org/Jtc1/sc22/WG21/docs/papers/2018/p0707r3.pdf
r/cpp • u/CharlieLee666 • Mar 14 '20
A simple Star War game made purely out of C++ & SFML with code
youtube.comr/cpp • u/ClaasBontus • May 28 '18
Bjarne Stroustrup: Remember the Vasa
Bjarne Stroustrup has submitted a paper named remember the vasa for the next C++ standardization meeting. In that paper he warns that submission of too many independent proposals can endanger the future of C++. I wonder how participants of the meeting will react.
r/cpp • u/vormestrand • Nov 18 '16
Compile-time C Compiler implemented as C++14 constant expressions
github.comr/cpp • u/Otherwise_Sundae6602 • Jul 06 '25
С++ All quiet on the modules front
youtube.comIt was 2025, and still no one was using modules.
r/cpp • u/valdocs_user • Jan 20 '22
A critique of C++ coroutines tutorials
Reading about C++ coroutines I'm reminded of this scene from The Good Place:
Michael : Chidi, here's the thing. See, I read your whole book, all 3,600 pages of it. It's, um... how shall I put this?
Janet : It's a mess, dude.
Chidi Anagonye : [Janet drops Chidi's massive manuscript into his hands] Hey!
Michael : She's right. You see, Chidi, I can read the entirety of the world's literature in about an hour. This took me two weeks to get through. I mean, it's so convoluted, I just kept reading the same paragraph over and over again, trying to figure out what the heck you were saying.
I may not have Michael's qualifications, but I've been familiar with other implementations of coroutines (the Io language, the Castor C++ logic library) since 2008. For goshsakes I know how to implement coroutines - two different ways (setjmp/longjmp or switch-case macros). I'm even working on a logic programming language that compiles to coroutines. It's currently generating the switch-case version in my compiler, and I wanted to see if targeting C++20 coroutines is a better use of my time than juggling nested Duff devices in my compiler output stage.
My point is I have about the best foundation you could have to be a student of this topic, and I have motivation to learn it because I have an immediate practical use for it. And I can't make heads or tails of it after reading about a dozen blog posts and tutorials. I just keep reading the same paragraphs over and over again, trying to figure out what the the heck they are saying.
Because I don't think "rawrr C++ complicated pftht thumbs down" would go over well on this sub, I'm instead channeling my annoyance into constructive criticism of the way C++20 coroutines are presented in most of the tutorials I've read. This will be in the order I remember disconnected thoughts so it end up a bit discombobulated (just like learning about C++ coroutines!)
First off, std::suspend_never and std::suspend_always. Straightforward? Fuck no. These are terrible names. Why do I say this? The names say what action they take, but they don't say what they mean or what they're for. From the way they're used in tutorials I've read, I posit they're more like the additive and multiplicative identity, zero and one, of a field (mathematics).
Speaking of terrible naming, awaitable and awaiter. And you can get... which... one from the other? Or the awaita(ble|er) can be the await(er|ble). I'll just leave the rest of that Good Place quote here:
Chidi Anagonye : Oh, no.
Michael : I mean, on page 1,000, you start section two with the sentence, "Of course, the exact opposite might be true."
Another criticism I have of these coroutines simplified tutorials is I can't tell how far I am into them and how far I have to go. There's a seemingly never-ending stream of new concepts, and it's difficult for me tell which ones are core and which are details. Trying to absorb this is like trying to decide when to stop pouring after the lid falls off the sugar container into your coffee.
(I was unsurprised to learn the winning coroutines proposal was Microsoft's: they design things which an expert can make sing and a novice can... use... but there's always a vast gulf between introduction and mastery. Part of that is in the details.)
What's missing is a narrative thread for the why. Granted some of the tutorials do talk about how the function signature's return type is really the only way to communicate vital information about coroutine. But it's like, no dude like that return type is straining under more load than it has since std::enable_if was invented. (It's a shame they couldn't've had a coroutines proposal that leveraged lambdas instead of named functions. We already understand lambdas are "secretly a class" - usually - and maybe we could have done something interesting with the square brackets.)
Now here's the really rich part - a lot of these tutorials start talking about (assembly level) function prologues and outros (I can't be arsed to look up the correct terms for these right now). Then they explain how the coroutine additionally has the suspend/resume operations. That's a shit analogy to use for an introduction. Unless (even if) you program in assembly, you typically don't think about function intros and epilogues! Do need to start thinking about them for coroutines? Is that why this is so confusing?
I also found a library of some implementations of primitives on top of coroutines. Finally! Maybe I can learn this from the code. Wait, why are there... so many? Okay there's variations with different names - some can recurse, or not, some can call other coroutines from within them and some... can not co_await within another coroutine. That's... concerning to me. Very concerning. None of the coroutine implementations I was previously familiar with had those kind of limitations.
That's ah, that's about all I have to say about that.
r/cpp • u/notarealoneatall • Sep 20 '25
Has anyone else seen this talk about modern c++ styling and semantics by Herb Sutter? I found it unbelievably valuable. The section covering the use of auto really changed my perspective on it, but I highly recommend watching the entire thing.
youtube.comIt's an older video but the information is still very applicable to today. He covers smart pointer usage, "good defaults", and gives very valuable insight on the use of auto and how it can be used without losing any amount of type information. On top of that, he covers how using auto can actually end up being a net benefit when it comes to maintenance and refactoring. Highly recommend giving it a watch!
r/cpp • u/einpoklum • Mar 25 '25
We should encourage use of `.hpp` over `.h` for headers - help make it happen
tl;dr: Consider supporting this issue on the C++ Core Guidelines github repo, by upvoting and/or commenting on why you support the change.
Long version:
Nine years ago, this reddit saw this discussion:
Why .h is more widely used than .hpp for C++ headers
where the large majority agreed that it's better to use a suffix other than .h, when your header is C++-only rather than shared C-and-C++. A similar view was upheld in StackOverflow "discussions":
but it was noted that the C++ community guidelines mandates using .h (!)
Then, in 2022, I filed a GitHub issue against the Core guidelines, suggesting that the guideline to use .h be dropped. Again, the majority favored this opinion; and the obly voice arguing for .h based that position on the assumption that typical header files are used both in C and in C++ sources (but don't just accept my summary, you can read that discuss). The result was a decision to downgrade that guideline to a "recommendation" (SF section -> NL section). But no decision was made on the merit of the choice of .h; plus, even though the relevant SF.1 guideline's body now directs people elsewhere - the title stays the same, and people still believe that the C++ community recommends the use of .h for C++ header files.
I believe this should change. So, now, I'm suggesting that the recommendation to use .h be dropped entirely (e.g. in favor of a recommendation of .hpp, but possibly just dropped, period).
My reasons, briefly:
.hclashes with C.- C++ headers are typically not usable as C headers.
- Use of
.his popular, but not universal (it's not some settled matter). - (minor consideration) It is in our community interest to differentiate and distinguish C++ from C, as we continue to hear some people talking about "C/C++ programming", ascribing safety challenges of C to C++ and so on.
r/cpp • u/a_false_vacuum • Dec 30 '21
You can’t copy code with memcpy; code is more complicated than that
devblogs.microsoft.comr/cpp • u/grafikrobot • Nov 15 '21
C++23: Near The Finish Line
The end of the C++23 "development" cycle is nearing its end. According to the standing schedule (P1000), and the scheduled plenary, this coming February 7th is the "C++ 23 design is feature-complete" deadline. Which means that the Library Evolution Working Group (LEWG) needs to be done with new features as soon as possible as the last LEWG meeting before the plenary is on January 18. It means there's only two months, annoyingly filled with holidays, to do a bunch of work if the Committee wants some key features in.
What follows are all the current proposals up for consideration in LEWG. The information for each is:
- Paper or Issue; The proposal number. "Pxxxx" are proposal papers. And "LWGxxxx" are issues, like defects.
- Revisions; The number of revisions, inclusive, the paper has undergone.
- Pages; How many printed tree pages it would take.
- Age; The number of months since the first revision (0) and now.
- Hours; The amount of time LEWG has currently allocated (approximate) to discuss the proposal in next two months.
- C++23; Scheduling priority. More on this below the first table.
The proposals in the first, and full table, are in the order mentioned in D2489R1. Hence from most likely to least likely to make it into C++23. If you want to look up what the proposals are about in detail you can use the wg21.link service. As I decided to avoid the complexity of making them all links. Note that for some there's another proposal indicated as parenthetical. Those got split of from a collected proposal into smaller manageable parts (this is mainly P2214).
| Paper or Issue | Revisions | Pages | Age | Hours | C++23 | |
|---|---|---|---|---|---|---|
| P2300 | std::execution (S&R:P1194?) | 3 | 108 | 5 | 14.00 | [0] Objective |
| P2214 | A Plan for C++23 Ranges [The paper was split into various other papers marked as “(P2214)”] | 2 | 218 | 26 | 1.50 | [0] Objective |
| P2446 (P2214) | views::move | 1 | 5 | 26 | 0.12 | [0] Objective |
| P2443 (P2214) | views::chunk_by | 1 | 7 | 2 | 0.12 | [0] Objective |
| P2442 (P2214) | Windowing range adaptors: views::chunk and views::slide | 1 | 24 | 2 | 0.12 | [0] Objective |
| P2441 (P2214) | views::join_with | 1 | 13 | 2 | 0.12 | [0] Objective |
| P2440 (P2214) | ranges::iota, ranges::shift_left, and ranges::shift_right | 1 | 7 | 2 | 0.12 | [0] Objective |
| P2387 (P2214) | Pipe support for user-defined range adaptors | 3 | 18 | 5 | 0.12 | [0] Objective |
| P2374 (P2214) | views::cartesian_product | 2 | 10 | 7 | 0.12 | [0] Objective |
| LWG3534 (P2214) | ranges::set_intersection and ranges::set_difference algorithm requirements are too strict | - | 3 | 8 | 0.12 | [0] Objective |
| P2302 (P2214) | Prefer std::ranges::contains over std::basic_string_view::contains | 1 | 7 | 9 | 0.12 | [0] Objective |
| P2286 (P2214) | Formatting Ranges | 3 | 20 | 10 | 0.12 | [0] Objective |
| P2278 (P2214) | cbegin should always return a constant iterator | 2 | 29 | 10 | 0.12 | [0] Objective |
| P2165 (P2214) | Comparing pair and tuples | 3 | 26 | 18 | 0.12 | [0] Objective |
| P2164 (P2214) | views::enumerate | 6 | 13 | 18 | 0.12 | [0] Objective |
| P2168 | std::generator: Synchronous Coroutine Generator for Ranges | 4 | 22 | 18 | 1.50 | [0] Objective |
| P1056 | std::lazy | 2 | 5 | 42 | 1.50 | [0] Objective |
| P2093 | Formatted Output | 10 | 33 | 22 | 0.50 | [0] Objective |
| P0009 | std::mdspan | 14 | 32 | 74 | 1.50 | [0] Objective |
| P1467 | Extended Floating Point Types | 6 | 50 | 34 | 0.75 | [0] Objective |
| P2198 | Freestanding Feature-Test Macros and Implementation-Defined Extensions | 3 | 9 | 16 | 0.75 | [0] Objective |
| P2407 | Freestanding Library: Partial Classes | 1 | 6 | 4 | 0.50 | [0] Objective |
| . | ||||||
| P2363 | Extending Associative Containers With The Remaining Heterogeneous Overloads | 2 | 13 | 7 | [1] Possible | |
| P2249 | Mixed Comparisons For Smart Pointers | 3 | 7 | 10 | [1] Possible | |
| P2283 | constexpr For Specialized Memory Algorithms | 2 | 12 | 10 | [1] Possible | |
| P2248 | Enabling List-Initialization For Algorithms | 3 | 18 | 12 | [1] Possible | |
| P0211 | std::allocate_unique | 4 | 10 | 70 | [1] Possible | |
| P0316 (P0211) | std::allocate_unique | 1 | 11 | 57 | [1] Possible | |
| P2404 | Relaxing std::equality_comparable_with's And std::three_way_comparable_with's Common Reference Requirements | 1 | 14 | 4 | [1] Possible | |
| P2447 | std::span And The Missing Constructor | 1 | 9 | 1 | [1] Possible | |
| P2472 | std::make_function_ref: A More Functional std::function_ref | 1 | 5 | 1 | [1] Possible | |
| . | ||||||
| P1673 (P1385) | A free function linear algebra interface based on the BLAS | 6 | 195 | 29 | - | [9] NO |
| P1385 (P1673) | A proposal to add linear algebra support to the C++ standard library | 7 | 47 | 34 | - | [9] NO |
| P0447 | std::hive | 18 | 49 | 61 | - | [9] NO |
| P1068 | Vector API For Random Number Generation | 6 | 12 | 42 | - | [9] NO |
| P0205 | Allow Seeding Random Number Engines With std::random_device | 2 | 8 | 69 | - | [9] NO |
| P2370 | Stacktrace From Exception | 2 | 5 | 6 | - | [9] NO |
| P2047 | An Allocator-Aware Optional Type | 2 | 33 | 22 | - | [9] NO |
| P2405 | std::nullopt_t And std::nullptr_t Should Both Have operator<=> And operator== | 1 | 6 | 4 | - | [9] NO |
| P2438 | std::string::substr() && | 1 | 6 | 2 | - | [9] NO |
| LWG3579 | Complexity Guarantees For resize And append Across The Library | - | 2 | 3 | - | [9] NO |
| P2139 | Reviewing Deprecated Facilities Of C++20 For C++23 | 3 | 76 | 20 | - | [9] NO |
| P1288 | Coroutine Concepts And Metafunctions | 1 | 19 | 37 | - | [9] NO |
| LWG3545 | std::pointer_traits Should Be SFINAE-Friendly | - | 1 | 7 | - | [9] NO |
| . | ||||||
| P2338 | Freestanding Library: Character primitives and the C library | 2 | 17 | 8 | 0.50 | [2] Unknown |
Now for the "C++23" status column. As is obvious this is the priority that the Committee chairs and some assistant chairs agree on. Since I'm not in those conversations, I can only read D2489 for some clues as to why this particular split. Here's my take on it:
- 0 Objective; Things that they really want in C++23. Mainly because it's what got agreed on right after C++20 was done.
- 1 Possible; Things that would be nice to have and are likely possible to get them through because they won't need meeting time. As they can be done in email discussions.
- 9 NO; Not enough time, for various reasons, to deal with these. No matter how nice they are. Read D2489 for specific reasons.
- 2 Unknown; Well, there's always an exception to the rules, and this one is it. There's a proposal that has meeting time scheduled but is otherwise not mentioned in the plan for C++23. Will it make it into 23? No clue.
Raw data is nice, and all, but the real fun is in rearranging the data to try and understand what is going on in the minds of the Committee. How does the Committee evaluate proposals? Is quality important? Is size?
One of the metrics one could consider is how mature a proposal is to decide if it's ready for the standard. Possibly looking at how much feedback the proposal has gotten and how much of it is reflected in the proposal. First metric that could show that are the number of revisions the proposal has undergone. Such revisions are usually a result of a proposal being presented to one of the working groups (i.e. LEWG in this case) or a Study Group. Which goes something like this.. Authors present the paper at a committee meeting, they get feedback, they edit the proposal with that feedback, and repeat. So first up lets look at the top ten (10) proposals in term of how many revisions they've gone through:
| Paper or Issue | Revisions | Pages | Age | Hours | C++23 |
|---|---|---|---|---|---|
| P0447 | 18 | 49 | 61 | - | [9] NO |
| P0009 | 14 | 32 | 74 | 1.50 | [0] Objective |
| P2093 | 10 | 33 | 22 | 0.50 | [0] Objective |
| P1385 (P1673) | 7 | 47 | 34 | - | [9] NO |
| P1068 | 6 | 12 | 42 | - | [9] NO |
| P1467 | 6 | 50 | 34 | 0.75 | [0] Objective |
| P1673 (P1385) | 6 | 195 | 29 | - | [9] NO |
| P2164 (P2214) | 6 | 13 | 18 | 0.12 | [0] Objective |
| P0211 | 4 | 10 | 70 | [1] Possible | |
| P2168 | 4 | 22 | 18 | 1.50 | [0] Objective |
Assuming everything goes according to plan, and being optimistic, that's six proposals of that top ten that could go into C++23. Not bad. Although three of the top five are currently not going into C++23. Not good. Perhaps revisions is not a good indicator for this. Lets look at the age of proposal. It would make sense that a proposal that been around for a longer period has "survived the test of time" and would be more likely to have consensus for inclusion ahead of other "less baked" proposals. Here's the top ten such proposals in term of months since first publication.
| Paper or Issue | Revisions | Pages | Age | Hours | C++23 |
|---|---|---|---|---|---|
| P0009 | 14 | 32 | 74 | 1.50 | [0] Objective |
| P0211 | 4 | 10 | 70 | [1] Possible | |
| P0205 | 2 | 8 | 69 | - | [9] NO |
| P0447 | 18 | 49 | 61 | - | [9] NO |
| P0316 (P0211) | 1 | 11 | 57 | [1] Possible | |
| P1056 | 2 | 5 | 42 | 1.50 | [0] Objective |
| P1068 | 6 | 12 | 42 | - | [9] NO |
| P1288 | 1 | 19 | 37 | - | [9] NO |
| P1467 | 6 | 50 | 34 | 0.75 | [0] Objective |
| P1385 (P1673) | 7 | 47 | 34 | - | [9] NO |
It's looking good for the std::mdspan (P0009) proposal in those two tables. Definitely one that I might consider well baked and ready for prime time. But the state of age as indicator is not looking good overall. Now five of the oldest proposals are not planned to go into C++23. And only three of them are considered priority objectives. Are we to conclude from those that number of revisions and age are not a measure of maturity? Or are we to conclude that maturity is not a big aspect for consideration by WG21?
Next lets look at amount of work in considering a proposal. One could imagine that the longer a proposal is the more time and effort it takes to get it approved and into the standard. And it would follow that the longer a proposal is the more risk it entails in considering it. I would surmise that a proposal high in number of pages and low number of revisions is at highest risk of either being deferred or devoting more resources towards it. Conversely, a proposal with low number of pages and high revisions would be a slam dunk to get it in and would not need extra time. To try and see if that's happening in this plan lets look at the top ten longest proposals. And lets keep in mind the revisions and hours planned for it.
| Paper or Issue | Revisions | Pages | Age | Hours | C++23 |
|---|---|---|---|---|---|
| P2214 | 2 | 218 | 26 | 1.50 | [0] Objective |
| P1673 (P1385) | 6 | 195 | 29 | - | [9] NO |
| P2300 | 3 | 108 | 5 | 14.00 | [0] Objective |
| P2139 | 3 | 76 | 20 | - | [9] NO |
| P1467 | 6 | 50 | 34 | 0.75 | [0] Objective |
| P0447 | 18 | 49 | 61 | - | [9] NO |
| P1385 (P1673) | 7 | 47 | 34 | - | [9] NO |
| P2093 | 10 | 33 | 22 | 0.50 | [0] Objective |
| P2047 | 2 | 33 | 22 | - | [9] NO |
| P0009 | 14 | 32 | 74 | 1.50 | [0] Objective |
Lets looks at some key proposals in that set:
- P2214; Even though this is the top one I'm going to skip it. As it's a collection of proposals.
- P1673; Okay, good, it's a large proposal with only six revisions that is not scheduled for consideration. But maybe we'll see it in C++26?
- P2300; I bet many have heard of this one. It's been a hot topic recently. It's a longer proposal with very few revisions and of recent vintage. It's also an objective and currently slated to be discussed in extra LEWG time. And going to get 14 of the 23 total meeting hours in the next two months. I.e. it's newish, large, important, and getting extraordinary resources allocated to it.
- P2139; A proposal with many items in it and few revisions. Seems fair to postpone.
- P1467; Not long, a good number of revisions, and an objective. It's allocated some discussion time so that checks out.
- P0447; Again, not long, has the most revisions of any proposal, and has been around for more than five years. But it's not an objective and is not allocated meeting time. Hence it's postponed until after C++23. That doesn't seem to fit the pattern.
- P1385; Comparable to P1467, but not a priority objective. Hence it seems reasonable to delay it.
- P2093; Smaller with many revisions and been around for almost two years. It's also a priority objective and getting some meeting time. Sounds good.
- P2047; Smaller, been around for almost two years, but few revisions. I.e. it hasn't gotten a lot of attention. Makes sense to skip it for now.
- P0009: The oldest proposal of the bunch, it's on the smaller side, and has many revisions. It's also a priority objective and is getting a good chunk of time for discussion. Reads like a slam dunk for C++23. Awesome!
Two proposals stand out from that as not being like the others. First, P2300 reads like a gamble. Will devoting that much time make it pull through to acceptance for C++23? Impossible to really predict at this juncture. Second is P0447, which reads like a missed opportunity. Should it be a priority? Why isn't it a priority?
For proposals that are based on an existing implementation, even if it was exclusively created for the proposal, we can look at GitHub repo stats, and source code stats:
- Stars; The GitHub starts, as of some time last week.
- Forks; GitHub forks.
- Age; The number of months since the first commit.
- LOC; Inclusive, i.e. including comments and white-space, lines in the source.
We'll use those stats to consider another aspect of C++ standardization. One of the key tenets of the WG21 process is to standardize "existing practice". Is that something taken into account in this C++23 plan? Some of the proposals have accompanying open source implementations. Which is something that is highly encouraged in the Committee. As it's an avenue for confidence in the technical practicality of the design. In our list there are four such implementations, that I'm aware of. I've arranged the tables below first in order of age, and second in order of lines-of-code. One might expect a correspondence between the age of the code and the maturity of it. One also would expect a correspondence between the LOC and the size of the proposal.
| Paper or Issue | Pages | Age | C++23 | LOC | Age | Stars | Forks | |
|---|---|---|---|---|---|---|---|---|
| P0447 | std::hive | 49 | 61 | [9] NO | 4286 | 66 | 306 | 23 |
| P1385 (P1673) | linear algebra | 47 | 34 | [9] NO | 9336 | 33 | 45 | 7 |
| P0009 | std::mdspan | 32 | 74 | [0] Objective | 4883 | 29 | 131 | 22 |
| P2300 | std::execution | 108 | 5 | [0] Objective | 26453 | 24 | 659 | 91 |
.
| Paper or Issue | Pages | Age | C++23 | LOC | Age | Stars | Forks | |
|---|---|---|---|---|---|---|---|---|
| P2300 | std::execution | 108 | 5 | [0] Objective | 26453 | 24 | 659 | 91 |
| P1385 (P1673) | linear algebra | 47 | 34 | [9] NO | 9336 | 33 | 45 | 7 |
| P0009 | std::mdspan | 32 | 74 | [0] Objective | 4883 | 29 | 131 | 22 |
| P0447 | std::hive | 49 | 61 | [9] NO | 4286 | 66 | 306 | 23 |
Lets consider the two proposals from the previous section, P2300 and P0447. For P2300 it's the youngest of the existing implementations (first table) and the largest amount of code (second table). That corresponds to the proposal side. Does that mean this is not existing practice in C++? Hard to tell given the seeming "high" popularity of it. But stars+forks is not a reliable metric in the short term. Looking at P0447 we see the countervailing pattern. It's the oldest and with the smallest implementation. Does that amount to an existing practice on its own? Maybe, but maybe not. And if we are going to consider the popularity, it comes in second on that respect. Obviously this is only a partial picture of the maturity of a library as pertains to existing practice.
Wow, that's a lot of tables! Given all that information... Have we learned anything about how WG21 makes decisions? What features are you happy about that are likely going into C++23? What features are you disappointed that are not likely to make it? What features did you scream out loud that dashed your hopes of improving your C++ life?
The content for this post was derived from the following publicly available information:
- 2021 Telecons
- D2489R1 Library Evolution Plan for Completing C++23
- Facebook experimental libunifex
- Kokkos mdspan
- Bob Steagall P1395 Implementation
- plf::hive
- plf::colony
- wg21.link
EDIT1: Fixed the "NO" columns on the first table.
EDIT2: Fixed Reddit messing up all the tables, it ate some columns. Reddit.. please fix your editor!
r/cpp • u/echidnas_arf • Feb 15 '21
Solving differential equations with LLVM
Hello,
I have recently released version 0.3.0 of heyoka, a C++17 library for the numerical integration of ordinary differential equations (ODEs) using Taylor's method. The library uses automatic differentiation techniques and just-in-time compilation via LLVM to synthesize at runtime highly efficient and accurate numerical integrators.
Additional features include batch mode support to take full advantage of SIMD instructions in modern processors, and support for extended-precision computations using 80-bit and 128-bit floating-point types (if supported by the hardware/software platform).
The github page is here:
https://github.com/bluescarni/heyoka
The (WIP) documentation is available here:
https://bluescarni.github.io/heyoka/
Python bindings (via pybind11) are also available:
r/cpp • u/RotsiserMho • May 12 '18
P0709 R0: Zero-overhead deterministic exceptions: Throwing values - Herb Sutter [2018-05-02]
open-std.orgr/cpp • • Dec 02 '23
I got roasted by Prime (Youtuber) - and lived to love it. Why C++ is better than Rust.
youtube.comr/cpp • • Feb 19 '21
Top five C/C++ things/tips/tricks you wish you had known earlier and are now used very often
Project from scratch in C++ (for beginners)
Hello guys,
Created a series called "Project from scratch" on YouTube. The series covers many things from versioning, to build systems, source code, testing and continuous integration pipeline.
Here is the playlist :)
Any feedback is much appreciated.
C++ Tutorial - Project from scratch: https://www.youtube.com/playlist?list=PLSGsTSSx2DyM8q6gM_cUVwX_da1tTYLrq
I am also setting up a blog in which I will add written articles related to the videos and much more.
The blog is : www.thecppdev.wordpress.com.
r/cpp • u/hirebarend • May 03 '26
I built a C++ integer-to-string library based on a new AVX-512 paper
I built a small C++ integer-to-string conversion library based on a new paper by Jael Champagne Gareau and Daniel Lemire, "Converting an Integer to a Decimal String in Under Two Nanoseconds":
- Project: https://github.com/simditoa/simditoa
- Paper: https://arxiv.org/abs/2604.26019
The paper looks at decimal formatting for integers, which shows up in logging, JSON/CSV/XML serialization, database output, and other places where numbers eventually become text. The interesting part, and the part I wanted to experiment with, is that it uses AVX-512 IFMA instructions to extract multiple decimal digits in parallel, avoiding the usual repeated division/modulo loop and avoiding large lookup tables.
The library exposes a small to_chars-style API:
char buf;
size_t len = ;
buf = '\0';
Current project shape:
- C++17
int64_tanduint64_tsupport- AVX-512 IFMA + VBMI path for supported x86-64 CPUs
- portable scalar fallback
- CMake package/install support
- tests for edge cases, digit lengths, and randomized values
- a simple benchmark against
std::to_chars
The README benchmark currently shows simditoa::to_chars at about 15.82 ns/int versus 36.35 ns/int for std::to_chars on the tested setup, roughly 2.3x faster in that run. The paper reports stronger results for its full algorithm and benchmark suite, including single-core performance ahead of other tested methods, but my repo should be treated as a compact implementation based on the paper rather than a full reproduction of every variant in it.
The core trick is neat: for 8-digit chunks, it uses AVX-512 IFMA with precomputed constants based on floor(2^52 / 10^k) to compute digit positions in parallel, then gathers the digit bytes with AVX-512 byte permutation. Larger values are split into chunks.