Have to admit that Klaus i in my opinion the best lecturer in CppCon! Thanks for speech ;)
@johnwellbelove14811 ай бұрын
I remember many years ago (when I was getting to grips with C++) coming across the algorithms. I applied them to our codebase and the reduction in the amount of code, and improvement in readability was astounding at the time. And what's more, no reduction in performance (the application was for real-time image analysis).
@Quarky_11 ай бұрын
Great talk! I'm halfway through, the examples are simple to follow, gives practical steps, compares different standards, and the icing on the cake is referencing previous talks for more details! Maybe someone can update the video description with links to these "further watching" talks?
@dimodimi11 ай бұрын
itCppCon20 - My Least Favorite Anti-Pattern (Conor Hoekstra) kzbin.info/www/bejne/eZurmH9reraXmbs CppCon 2019: Conor Hoekstra “Algorithm Intuition (part 1 of 2)” kzbin.info/www/bejne/poaon4JsiNt0g9E CppCon 2019: Conor Hoekstra, “Algorithm Intuition (part 2 of 2)” kzbin.info/www/bejne/qXbZiqCYaMp-qdk CppCon 2016: Ben Deane "std::accumulate: Exploring an Algorithmic Empire" kzbin.info/www/bejne/eGfXqKKwg7WIpaM CppCon 2018: Jonathan Boccara “105 STL Algorithms in Less Than an Hour” kzbin.info/www/bejne/aKDPpHqca698obc C++ Seasoning was already posted in the comments
@nicolabombace200410 ай бұрын
Klaus' conference talk? Like before watching! EDIT: Finished the talk, I wish there was a double like button! :D
@abhilekhgautam59632 ай бұрын
Excellent talk !!
@WhiteEyeTree10 ай бұрын
@27:12 Instead of using rotate you could just partition for the negation of what you want in the end, everything that is not what you want in the end gets put in front of it. It also maintain the relative order. Just a thought.
@nicolabombace200410 ай бұрын
This is actually addressed @54:25. It was an inside joke to mention rotate
@RonanMevel11 ай бұрын
Great talk, thank you !I've always ket in my mind the talk from Sean Parent you've mentionned and his advise : Know your STL !
@VoidloniXaarii11 ай бұрын
Thank you for this both great and entertaining even at times amusing talk! So much to learn... Makes great teachers of deep knowledge rather priceless... Thank you
@hwval-zw4hy11 ай бұрын
1. C++ seasoning 2. 105 STL algorithms in less than an hour 3. Algorithm intuition
@oddprhyme11 ай бұрын
well prepared talk. good job and thank you!
@spacelem10 ай бұрын
As a mathematical modeller, most of my code looks like while (t < T) { /* lots of complex code with many layers of loops */ } Trying to remove the main loop feels like a gargantuan task, however I do like to use algorithms wherever it makes life easier (which probably isn't the main loop).
@nigelstewart998210 ай бұрын
Nice one Klaus. I was thinking of making a trip to the USA this year, perhaps CppCon 2024 is as good excuse as any?
@John-xl5bx11 ай бұрын
On one hand this is great - there is a more elegant way to do these things. On the other hand, we now have yet one more substantially different way to do basic things. Even "using the STL algorithm" now includes several alternate approaches. This worsens the C++ code readability nightmare. The technical debt compounds....
@StanleyPinchak10 ай бұрын
Unmaintainable for loops for teh win!
@SimonToth8311 ай бұрын
@44:00 Definitely worth mentioning that the result is now non-deterministic (which can be totally fine).
@multiHappyHacker11 ай бұрын
I suspect that using an operator overload to make Person less-than-comparable would be making your code depend on the algorithm code instead of the other way around.
@discotecc3 ай бұрын
At first, overloading < doesn't seem like a bad idea as you can do this without touching the class you're establishing an order for but then you're out of luck if you're wanting your collection of objects to have more than one distinct/meaningful ordering to it
@steelpanther8810 ай бұрын
This is quite nice this ranges stuff... Well, at least we can do our own projects with c++ 20. The joys of working with legacy code😔 Btw is this ranges included in g++ 12.3.0 ?
@multiHappyHacker11 ай бұрын
Also, is it possible to use the projection-based form of min_element when you have a struct composed of 3 more structs? (and the element you are looking for is a sub-element of one of those inner structs)
@randfur10 ай бұрын
The projection can be a lambda function so yes.
@fbjerno111 ай бұрын
I think in practice the time it takes to read the raw code in many of these examples is shorter than the time it takes to look up the algorithm function on cppreference. Using indexing and size() instead of begin()/end() would in my opinion be way clearer, especially for people who program in languages other than C++.
@nigelstewart998210 ай бұрын
C++ containers do not necessarily support random access for indexing, or even know their own size. That's the generality of iterators.
@Roibarkan11 ай бұрын
C++ Seasoning, Sean Parent, GoingNative 2013: kzbin.info/www/bejne/p3mZpIaFp5KsoZo
@letsbegin_staytrue11 ай бұрын
Thanks !!
@cranil10 ай бұрын
Only problem with the talk is Bart would never be this nice to Lisa 😂
@ulysses453611 ай бұрын
Yeah, one should really learn to appreciate the STL. And the fact that it's free. I love ranges, even though many useful things are only added in v23. It's still a very helpful thing in 20 as you present
@christer89649 ай бұрын
@27:26 Shouldn't pos be pos.begin()?
@coarse_snad9 ай бұрын
I think it's because 'pos' is an iterator. The '.begin()' method on containers is used to get the start iterator from them, but 'pos' is already an iterator here.
@KX3611 ай бұрын
what if the bart simpsons i know only use C arrays, raw loops and pointer arithmetic and cast every pointer to a void* because they religiously believe it performs better but they refuse to piss off and get C jobs.
@sprytnychomik9 ай бұрын
That int in accumulate doubles situation shows how type-safe C++ really is. Not even a warning [from a compiler].
@The1RandomFool10 ай бұрын
Isn't a successful exit of the program supposed to require returning 0? It seems odd to me that someone would make a macro named EXIT_SUCCESS just for 0. At least in Fish, it will print the exit code of the program to the terminal if the exit code is not 0.
@Key_Capz_11 ай бұрын
well, since you put it that way, it makes more sense.
@JansthcirlU10 ай бұрын
The absolute irony of doing a whole talk about single-dimensional ranges and naming the main variable for all of your examples 'table'
@stefanplusplus91711 ай бұрын
the simpsons made this amazing talk 10x better. or maybe they made it amazing in the first place😜
@sciptick11 ай бұрын
Listing "Containers" as primary to the STL is extremely weird. The most essential part of the STL was always the iterators. After that, the algorithms. The containers were meant mainly as examples. Stepanov's expectation was that people would routinely make up their own containers; it was quite a surprise that the initial containers proved adequate for so much development, and have been added to so very slowly. His hope was that the list of algorithms would be added to by many, continually. That hope was disappointed. The whole library was meant as a way to make important algorithm implementations universally usable, and thus amortize work on optimizing testing, and proving them over widespread use. Fun fact, priority_queue got in only because Stepanov thought the committee would cut the library down, so priority_queue and for_each were "sacrificial", added to save stack, queue, and accumulate from being cut. He was astonished when the committee took it all as-is. It is why priority_queue needed so much repair, after.
@HyenaEmpyema11 ай бұрын
people writing their own containers instead of getting things done is extremely weird. You really think we're supposed to re-invent map and vector? lol okay...
@lidegao11 ай бұрын
love the simpsons
@ElPikacupacabra11 ай бұрын
I'm gonna to keep it real with you chief. I prefer to do for loops. 😐 I would rather memorize a few useful algorithms than C++ syntax and a grab-bag of function names. If I know the algorithms, I will be able to use them forever, in any programming language.
@ukissrulez11 ай бұрын
You overestimate yourself. You are a nobody watching youtube videos.
@HyenaEmpyema11 ай бұрын
that's fine, and without knowing it you're wasting your own time writing and re-writing algorithms that have already been written, optimized and debugged. If you prefer to sit in the warm kiddie pool that is safe, familiar, and full of urine, that's always your choice. But there's way more out there for people who have ambition.
@colinjohnson551510 ай бұрын
The other thing I’ve noticed as a cpp newb is how many helper funcs are C++20 which is a letdown after searching for std lib tools in languages like C#, Go, JS and Python.
@alirezanikpay10 ай бұрын
Sure, you should know the algorithms, but you should use the proper library in your language to use them. It's like I should know how to cut a tree with axe, but I prefer chainsaw if it's available.
@not_ever10 ай бұрын
I’m gonna keep it real with you. I don’t want to work with you or any code you’ve worked on. I prefer code to be readable and not contain bugs. I don’t want to reason through your, or anyone else’s, hand rolled version of an stl algorithm I already know or can recognise at a glance and look up on cpp reference. Yes you should know how algorithms work under the hood and be able to implement them if necessary but writing idiomatic code is important in all programming languages and C++ is not an exception to this rule.
@u28OO10 ай бұрын
C++ SUCKS!!! It's slow as hell!! I always have to go back to C functions for a 4x performance boost!1;1!!1
@nigelstewart998210 ай бұрын
You may have overlooked the fact that the compiled for loop compiled to the same assembly as the C++ algorithm. No way that is a 4x performance boost.
@StanleyPinchak10 ай бұрын
🤡
@n00blamer9 ай бұрын
Obvious bait, but fuck it, I am a troll too: copy paste your C code into cpp file and compile it with a C++ compiler. PWN3D.