@7:57 I guess when you pass a span with a static extent to a function that accepts a span with a dynamic extent, the span within the function has a dynamic extent, regardless of the original span's extent. This is because the type of the parameter param in your function PrintArray is std::span, which defaults to std::span. So within the function, param.extent is std::dynamic_extent, even though the original span had a static extent.
@thestarinthesky_ Жыл бұрын
Thanks Mike for covering C++ 20 features. Looking forward to std::range as well :) I am glad C++ continues growing and evolving.
@MikeShah Жыл бұрын
Cheers!
@thestarinthesky_ Жыл бұрын
It seems we can use std::span for C-style array too. So when we pass a C-Style array to a function or method, we can use std::span to prevent pointer decay with the benefit of getting the size of using std::span's size method! Cool!
@MikeShah Жыл бұрын
Correct! This is one of the great things about span :)
@bsdooby Жыл бұрын
Maybe relate this concept to `std::string_view`; as such one appreciates the similarities (purpose) more.
@thestarinthesky_ Жыл бұрын
Thanks!
@MikeShah Жыл бұрын
Thank you again for this generous gift!
@LeonardoSalvatore Жыл бұрын
Thanks
@MikeShah Жыл бұрын
Thank you for your support! Cheers!
@LeonardoSalvatore Жыл бұрын
@@MikeShah thank you for your work. Cheers!
@MehmedUlusay2 ай бұрын
Thanks, but 14:44 it’s wrong that span is read-only view. We can modify the underlying array with span.
@MikeShah2 ай бұрын
True, can indeed modify the underlying data.
@robertstrickland9722 Жыл бұрын
Have you tried, and had issues with, utilizing any of the C++20 functionality in the new M-series Macbooks? I was reading about std::span and template concepts and when I tried to compile some test code, clangd on my macbook would always fail and it turns out that none of those c++20 features were available. I seemed to have a pretty up to date version of clang yet still nothing. C++20 STL libraries work just fine on my Linux machine.
@MikeShah Жыл бұрын
Might need to update your version of clang perhaps? Haven't had issues for anything c++20 related. I think MSVC at this time is the compiler supporting more of the C++23 features.
@kevinzebb Жыл бұрын
Any chance you’d be willing to show or give insight into work you’ve done in the past or are currently doing? I like these videos but it would be interesting to see how they’re applied in real world applications with a narration as to prevent confusion or getting lost when one reads by ones self.
@MikeShah Жыл бұрын
Thinking about more project-based work after this series gets to a point where videos can slow down 🙂
@mehtubbhai9709 Жыл бұрын
I am looking forward to it👍
@theintjengineer Жыл бұрын
Another amazing video. THANK YOU. Greetings from Germany.
@MikeShah Жыл бұрын
Cheers! Thank you!
@tourdesource Жыл бұрын
Really enjoyed the lesson, Mike! That was a lot of "here" though 😁were you nervous?
@MikeShah Жыл бұрын
Cheers! 😛
@VoidloniXaarii11 ай бұрын
Thanks a lot, this had many helpful insights
@MikeShah11 ай бұрын
Cheers!
@VoidloniXaarii11 ай бұрын
@@MikeShah 干杯,威士忌
@StefaNoneD Жыл бұрын
I will never understand why developers don't use autocompletion. The amount of compile errors you'll get when you type everything manually or the time to look for documentation, is not justifiable.
@MikeShah Жыл бұрын
Large projects autocomplete is a good idea. Teaching and learning it's a distraction and the error messages are sometimes useful to decipher live 🙂
@majorsuchodolski1254 Жыл бұрын
Nice!
@MikeShah Жыл бұрын
Cheers!
@codigo-nodosyvfx Жыл бұрын
Great video
@MikeShah Жыл бұрын
Cheers!
@victoreijkhout7115 Жыл бұрын
Why don't you demonstrate the non-owning aspect? Set an element in the span, see that it's changed in the original. That's the whole point of span. so your remark about read-only at the end is also beside the point.
@MikeShah Жыл бұрын
Fair point! span probably deserves another video as it is a potentially safer and equally efficient way to pass around data.