C++ From Scratch: std::span

  Рет қаралды 5,098

Nick

Nick

Күн бұрын

Пікірлер: 18
@RevolutionaryUsername
@RevolutionaryUsername 2 жыл бұрын
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
@zmweb4828 Жыл бұрын
Currently reading through Bjarne Stroustrup's "A Tour of C++" and this video really cleared up some confusion I had. Thanks Nick!
@quant-prep2843
@quant-prep2843 2 жыл бұрын
Hey man could you please make a detailed video on c++ memory order and atomic?
@NotesByNick
@NotesByNick 2 жыл бұрын
Will be covering more advanced memory topics when we get into parallel programming + threads!
@quant-prep2843
@quant-prep2843 2 жыл бұрын
@@NotesByNick really excited! honestly your way of teaching C++ is so much elegant and intuitive! most underrated C++ channel ever
@NotesByNick
@NotesByNick 2 жыл бұрын
@@quant-prep2843 thanks! Glad you think so :^)
@MrSebaleme
@MrSebaleme Жыл бұрын
Really cool video!! You are quite a gifted popularizer
@bpeachey1475
@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
@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
@engdoretto
@engdoretto 2 жыл бұрын
You're a great teacher....thanks a lot!!!
@NotesByNick
@NotesByNick 2 жыл бұрын
Thank you for watching! :^)
@shipweck6253
@shipweck6253 10 ай бұрын
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_m3092
@thomas_m3092 2 жыл бұрын
Might be worth mentioning that std::span is readonly.
@NotesByNick
@NotesByNick 2 жыл бұрын
Not sure what you mean - you can modify the underlying memory of a span - godbolt.org/z/MhsxdWqnM
@NotesByNick
@NotesByNick 2 жыл бұрын
Maybe you’re thinking of std::string_view? (Which is read only)
@closerlookcrime
@closerlookcrime Жыл бұрын
Thanks.
@CharlvandeMerwe
@CharlvandeMerwe 6 ай бұрын
Is that how we're supposed to pronounce "std"? I don't like it 😂. I prefer pronouncing it as "standard".
C++ From Scratch: Structs
8:04
Nick
Рет қаралды 1,3 М.
C++ From Scratch: Constexpr
9:45
Nick
Рет қаралды 11 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
C++ From Scratch: push_back vs. emplace_back
9:40
Nick
Рет қаралды 4,6 М.
Back to Basics:  RAII in C++ - Andre Kostur - CppCon 2022
44:17
STL std::span  | Modern Cpp Series Ep. 115
16:03
Mike Shah
Рет қаралды 6 М.
C++ Weekly - Ep 425 - Using string_view, span, and Pointers Safely!
8:36
C++ Weekly With Jason Turner
Рет қаралды 14 М.
C++ From Scratch: std::atomic
10:56
Nick
Рет қаралды 11 М.
Software Development with C++: Debugging with Valgrind
17:26
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.