There was a clear lack of coverage of std::span on KZbin. Your older video about spans helped me complete a project about a month back. Glad to see a newer one now! Thank you!
@zmweb4828 Жыл бұрын
Currently reading through Bjarne Stroustrup's "A Tour of C++" and this video really cleared up some confusion I had. Thanks Nick!
@quant-prep28432 жыл бұрын
Hey man could you please make a detailed video on c++ memory order and atomic?
@NotesByNick2 жыл бұрын
Will be covering more advanced memory topics when we get into parallel programming + threads!
@quant-prep28432 жыл бұрын
@@NotesByNick really excited! honestly your way of teaching C++ is so much elegant and intuitive! most underrated C++ channel ever
@NotesByNick2 жыл бұрын
@@quant-prep2843 thanks! Glad you think so :^)
@MrSebaleme Жыл бұрын
Really cool video!! You are quite a gifted popularizer
@bpeachey1475 Жыл бұрын
Thanks for the video, it's good stuff. How would one go about copying data from a span and thus transfering or taking ownership of it?
@NotesByNick Жыл бұрын
So a span does not own the underlying data, so there's no way to take ownership of the underlying memory directly from a span (e.g., if you took a span of part of a vector, the vector still owns the underlying memory, and you can't steal it away through the span). If you want to copy the data, somewhere else, that's perfectly fine (but that's not transferring/taking ownership, that creating a copy) Cheers, --Nick
@engdoretto2 жыл бұрын
You're a great teacher....thanks a lot!!!
@NotesByNick2 жыл бұрын
Thank you for watching! :^)
@shipweck625310 ай бұрын
can you talk about how to template std::span? i tried the obvious method: template void print_span(std::span _span_); and it didn't work. I would have to explicitly construct a std::span at the call site (print_span{vec}). This isn't too bad but I don't understand why it cant implicitly convert to a std::span without me having to manually construct one, which might lead to a copy of the span being made, since I am constructing the span at the call site and also passing it to the function, meaning it probably copies itself. Then I would have to pass it by rvalue reference or const reference, which ultimately defeats the purpose of using span. Is there a simple way to template std::span without having to explicitly construct it at the call site?
@thomas_m30922 жыл бұрын
Might be worth mentioning that std::span is readonly.
@NotesByNick2 жыл бұрын
Not sure what you mean - you can modify the underlying memory of a span - godbolt.org/z/MhsxdWqnM
@NotesByNick2 жыл бұрын
Maybe you’re thinking of std::string_view? (Which is read only)
@closerlookcrime Жыл бұрын
Thanks.
@CharlvandeMerwe6 ай бұрын
Is that how we're supposed to pronounce "std"? I don't like it 😂. I prefer pronouncing it as "standard".