Move Semantics in C++

preview_player
Показать описание


This video is sponsored by Skillshare.
Рекомендации по теме
Комментарии
Автор

Hope you all enjoyed the video! This is just the beginning of the Move Semantics Saga™, still to come is std::move, the move assignment operator, and more! Thanks for watching! ❤️

P.S. RELAX GUYS THE PS5 PART 2 VIDEO IS COMING TOMORROW

TheCherno
Автор

In case anyone is wondering why there is only one "Destroyed" line being printed on Cherno's terminal, remember that his program halts due to "std::cin.get()". Once he presses Enter, he should see the other "Destroyed" message.

Reason for two destroys: 1 where the hollow object is destroyed + 1 where the actual heap memory is deallocated.

Hope this saves time for someone and helps!

shah.kairav
Автор

8:24 noexcept is important for performance reasons. In a talk I saw, the example presented was 60% faster using noexcept because of the nature of push_back operation in std::vector. So keep that in mind!

Norhther
Автор

Holy shit. I thought I knew things. I don’t know anything. This channel has been such a blessing. Instant sub.

nabeelsherazi
Автор

I owe you a huge thank you ! I've been trying to understand what are lvalue and rvalue for quite a long time, and an even longer time for what the move semantic was all about, and I've finally understand it with your video.
I'm in a big learning phase right now, and your channel is an awesome way to improve myself. Thanks for the good work !

TiredLemonpie
Автор

m_Data = new char[m_Size] should be freed with delete [ ] m_Data; and not delete m_Data;

iiTzLamar
Автор

Thank you so much for this move semantic vid. This has been wildly helpful to me today. Love your channel, your C++ playlist is by far my favorite of all C++ content.

toddwasson
Автор

This C++ series will never run out of topics to make a video about :)
I've got too many requests what to cover in next videos.
For example Multithreading: it would take forever to make videos about threads, locks, lock-free synchronization, fibers, coroutines etc.

alextiga
Автор

My first professional language was C++, and I moved from it in 1998 when I started working in Internet / Social media. I've moved back to writing low level code on hardware again, and I've been enjoying your videos a great deal. C++ has come a long way, and you've made my transition back a very easy one.
BTW, I love the Hazel stuff too. Last time I worked with 3D graphics was when bsp trees were a new thing (and "fingering John Carmack" was something that was regularly done...) Fun to see how far that has all gone. I'm not doing any graphics right now, but fascinated with amount of forward movement in the field over the past 25 years.

ericprincen
Автор

This makes way more sense than what was being taught to me, where we just pushed multiple of the same object into a vector with different values (i.e. vec.push_back(Move{10})... vec.push_back(Move{n})). Sure it works, but doesn't help with visualizing the need to use a move constructor or semantics. This video helps so much, it just clicked instantly after watching this!

DassVeryGood
Автор

Founding this channel is a god damn blessing for me. Why did I not know about you earlier? Probably spent my whole life of luck on this.

khoing
Автор

Thank you for this video! This is one of my favorite series on YouTube and this is a topic that can be quite confusing but you simplified it beautifully. Great job and keep up the good work

aqezzz
Автор

Wow, naming a parameter "string" is quite... courageous:-)

JayAnAm
Автор

Yes the ps5 part 2 is coming this weekend, whose looking forward to that

hamdaman
Автор

Some of the videos are really clear cut and understandable, but I must say that in this one I dropped the ball very quickly. In like 10 seconds there appeared 50 lines of code and multiple class with their methods, privates, publics, printf, memcpy, delete etc.

Yupppi
Автор

OMG! Ever since your view_string video, I've been obsessed with making my own string_view! After this video I was able to mimic some functionality via referencing the same memory! With some extra steps I can prevent writing! Thanks so much!!

chawnneal
Автор

Very nice and excellent video!!! Tho I've got a small question: should we be usong "delete [ ] m_Data" in the destructor? Since it is created from "new [ ]"

Albert-lrky
Автор

Finally ... It's here. Thanks Cherno.
Next awaited
Regex
SFINAE
Random engines

praveen
Автор

I KISS YOUR EYES! I didnt unterstand it with my book, but then i found you. R Value Refenrences and Move Semantics are very usefull

halaszka
Автор

Man I was waiting for this from ages 😭😭😭😭, FINALLY Thanks Chernikov 😄

nallaprakash