The critical discourse should not targeted toward C++ as a language, but towards miscalibrated behaviors eg: people being addicted to designing and desiring abstractions that are more complex and less flexible than the raw version.
Modern C++ is just out of this world 🤣 Making simple things complex, and in this case performance of for loop is still better.

Oct 6, 2025 · 10:16 PM UTC

Not ditching functional programming but the fact that this is evidently poorly implemented in C++. Additional complexity e.g. when debug-stepping the code or dealing with fixing a build error. Runtime performances are worse too.
2
1
28
Replying to @ocornut
People arent addicted to abstraction, this is just good old functional programming. Yes, it has its use even in performance critical system. Yes, current compiler can be better in this regard. The two don't contradict.
1
22
This is not what C++ is for tho, and pretending it is only brings on new problems. There’s no way the compiler is going to be better here.
6
1
17
Replying to @ocornut
True ! There are many blades in the swiss army knife, if it's a screw, use the screwdriver blade and stop blaming the knife. From a teacher's perspective it's hard: students are excited to use/show their knowledge and it's normal. Normally, soon they become wiser, but not always.
Replying to @ocornut
Many programmers (such as myself some years ago) mistake simple code to "layered code". A truly simple code is not one where you have multiple layers of abstraction hiding complex inner logic, but one where the logic is totally explicit and straightforward.
1
17
Replying to @ocornut
Nothing personal but that's a dumb take. Not everyone is a fucking quant dev and needs top speed. On the same article, the guy shows another example where ranges let you write cleaner code. The point is to benchmark your code and to not marry a tool. Use what you need.
10
Replying to @ocornut
This is actually very beautiful, anyone who coded in a functional language before will appreciate it.
1
1
8
Replying to @ocornut
Having this abstraction available for whenever it is needed isn’t bad at all. The language doesn’t force you to use any abstraction over the other. It’s your use case that does. And to have 2 different abstractions in the toolbox is not had thing. The bad things in this snippet are: the example is horrible, and the C++ legacy syntax makes such abstraction feel a little out of place.
1
8
Replying to @ocornut
accurate
5
Replying to @ocornut
it's ironic. C was powerful for keeping the language as simple as possible == moving as much as possible out of the language, into headers and libraries
2
5
Replying to @ocornut
The ranges library, ( opt in btw ) sacrifices a little performance for functional programming. It shines when composing algorithms from the stl library.
5
Replying to @ocornut @SheriefFYI
It is a rat race in who will be writing the most unreadable APIs!
4
Replying to @ocornut
Most people just follow philosophy of the language and they will use language features just because they spend time to learn them. "I paid for the whole speedometer, I will use the whole speedometer".
3
Replying to @ocornut
I was using C++ 14 but now converted all to C99 it didnt took much time. Code is simplified I removed much more than I've added.
1
2
Replying to @ocornut
It’s just hold over from pre-SIMD days. They’re still coding like it’s 1999 avoiding loops at all costs lol
1
Replying to @ocornut
I think the complexity and flexibility of either approaches are subjective and providing abstractions alongside the raw equivalents is ideal.
1
1
Replying to @ocornut
Well said. I think the psychology of it is that we like cool things, exciting, glamorous, and we often forget the simplicity is quite often not so "cool".
1
Replying to @ocornut
That's just functional idiom support. No inherent additional complexity
1
Replying to @ocornut
Hello imgui guy
Replying to @ocornut
iirc main idea behind cpp was that its c with oop. and I fucjing hate std library
Replying to @ocornut
That is a great example of trying to be something that you're not. Trying to be Rust but it is not.
Replying to @ocornut
The abstractions should serve a purpose. You do it for some function. Haskell people have list comprehensions because you can compose them from disparate sections of the codebase. The C++ code is entirely form with the same function as a loop, is it not?
Replying to @ocornut
I find the use of auto here the most offending, actually
This tweet is unavailable
Replying to @ocornut
This one might not be a good example of this marvelous technology, but I once was so tired implementing algorithms involving tree traversals so I created a (pre-order) tree traversal iterator. And ranges are a nice concept for a composable API!
Replying to @ocornut
Yet this abstraction is less complex and more flexible. The idea of a filter seems pretty upfront. Yet another alternative would be std(::ranges)::copy_if, which specifies what you’re doing (good) but requires explicit declaration of the output vector.
1
6
Replying to @ocornut
Modern C++ is just a joke. And a pain in the ass to debug code that is not yours. Coroutines should never had arrived to C++.