C++ Weekly - Ep 401 - C++23's chunk view and stride view
Vložit
- čas přidán 5. 11. 2023
- ☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟
Upcoming Workshop: Understanding Object Lifetime, C++ On Sea, July 2, 2024
► cpponsea.uk/2024/sessions/und...
Upcoming Workshop: C++ Best Practices, NDC TechTown, Sept 9-10, 2024
► ndctechtown.com/workshops/c-b...
Check out Undo's Time Travel Debugging! undo.io/cppweekly
Episode Details: github.com/lefticus/cpp_weekl...
T-SHIRTS AVAILABLE!
► The best C++ T-Shirts anywhere! my-store-d16a2f.creator-sprin...
WANT MORE JASON?
► My Training Classes: emptycrate.com/training.html
► Follow me on twitter: / lefticus
SUPPORT THE CHANNEL
► Patreon: / lefticus
► Github Sponsors: github.com/sponsors/lefticus
► Paypal Donation: www.paypal.com/donate/?hosted...
GET INVOLVED
► Video Idea List: github.com/lefticus/cpp_weekl...
JASON'S BOOKS
► C++23 Best Practices
Leanpub Ebook: leanpub.com/cpp23_best_practi...
► C++ Best Practices
Amazon Paperback: amzn.to/3wpAU3Z
Leanpub Ebook: leanpub.com/cppbestpractices
JASON'S PUZZLE BOOKS
► Object Lifetime Puzzlers Book 1
Amazon Paperback: amzn.to/3g6Ervj
Leanpub Ebook: leanpub.com/objectlifetimepuz...
► Object Lifetime Puzzlers Book 2
Amazon Paperback: amzn.to/3whdUDU
Leanpub Ebook: leanpub.com/objectlifetimepuz...
► Object Lifetime Puzzlers Book 3
Leanpub Ebook: leanpub.com/objectlifetimepuz...
► Copy and Reference Puzzlers Book 1
Amazon Paperback: amzn.to/3g7ZVb9
Leanpub Ebook: leanpub.com/copyandreferencep...
► Copy and Reference Puzzlers Book 2
Amazon Paperback: amzn.to/3X1LOIx
Leanpub Ebook: leanpub.com/copyandreferencep...
► Copy and Reference Puzzlers Book 3
Leanpub Ebook: leanpub.com/copyandreferencep...
► OpCode Puzzlers Book 1
Amazon Paperback: amzn.to/3KCNJg6
Leanpub Ebook: leanpub.com/opcodepuzzlers_book1
RECOMMENDED BOOKS
► Bjarne Stroustrup's A Tour of C++ (now with C++20/23!): amzn.to/3X4Wypr
AWESOME PROJECTS
► The C++ Starter Project - Gets you started with Best Practices Quickly - github.com/cpp-best-practices...
► C++ Best Practices Forkable Coding Standards - github.com/cpp-best-practices...
O'Reilly VIDEOS
► Inheritance and Polymorphism in C++ - www.oreilly.com/library/view/...
► Learning C++ Best Practices - www.oreilly.com/library/view/... - Věda a technologie
I love these in rust and am glad to see them being incorporated into c++
I think the difference between chunk_by and split is the latter filters out the delimiter.
C++ should have langauge feature similar to iota (because it is far too long to type) but the reason I think it should be a language feature is to somehow cover the use cases of index_sequence and integer_sequence too (that'd also reduce the need for their 'make' counterparts). Just think about it, a simple terse syntax to get a range of integers whether you need it at runtime or compile-time. How does that sound?
Hrm. I'm still on g++ 11.2, so it's not going to work for me. I'm leery of manually updating the compiler because of past issues, so until my distro updates this will be yet another feature I can't make use of in conventional ways. It also illustrates a problem with languages taking so long to finally add features that should've existed since the beginning.
Change your distro. It's as simple as that. Slow moving distros slow us down.
@@ohwow2074 Nah, I'll just not make use of a barely useful feature that should've always existed anyway, or I'll find a Boost equivalent.
@@anon_y_mousse it's not just about ranges. You're missing out on a lot of new features.
@@ohwow2074 Have any examples of something I can't easily do myself?
@@anon_y_mousse span? Coroutines and concepts? Deducing this? Spaceship operator?
Have you guys already take a loop at ranges-v3 library?
Short isn't a problem
At least, that what's she said.
Badaboom
hmm the title says stride_view but I don't think you talked about it in the video.
he did talk about it towards the end
The std::views::chunk and std::views::stride are actually the objects of std::ranges::chunk_view and std::ranges::stride_view. So, effectively, they're the same.
(you can give it a try mate)
@@abhinavk0929I must have not noticed it. In my mind I heard him talk about chunk_by then the end of the video. After rewatching the end I see I was wrong heh.
If i get this correctly then stride is 'chunk and take the first element'?
@@benjaminshinar9509 Yeah you can say. But in my mind, stride(n) is something like:
for (int i = 0; i < x; i += n) { /*you get the point*/ }