I was recently pleasantly surprised to be invited to have a chat with the guys on CppCast! You can listen to how I lowered the tone in general here: cppcast.com/one-lone-coder/ A big thanks to Rob and Jason for giving me the opportunity, they were great guys and it was great fun :D
@xXGskillsniperXx3 жыл бұрын
My favorite c++ youtubers making a podcast == ❤️
@20thCB3 жыл бұрын
I listened to the whole thing! Congratulations on the new arrival :-)
@treyquattro3 жыл бұрын
massive kudos! Jason is my go-to (no, not goto) resource for keeping up to date with the language. I'll check out the podcast.
@samuelcampbell65593 жыл бұрын
Napping is a thing, podcasts are a thing, coding is a thing and enjoying your videos is also a thing. If only there was a way I could smash all of these pursuits together... There is!
@jonedwards38273 жыл бұрын
I thought it was a great listen, both on your philosophy towards getting people into coding and very interesting generally on robot work and PhD, congrats too, much appreciated, leaning lots.
@anonanon30663 жыл бұрын
One of my favourite things about your content is that you show that C++, a language generally known to be "complicated and unwieldly", can be one of the most elegant and beautiful languages out there.
@fastmovingvolcanomatter3 жыл бұрын
I don't know that "elegant" is the word I'd use to describe the language itself. I think the extreme flexibility afforded by how precise you can be in programming to your exact needs lends itself well to providing opportunities to write elegant code, but the language as a whole isn't elegant I don't think. Like, think about all the duplicate functionality C++ has from C backwards compatibility (mostly to do with pointer and memory management stuff). Or some of the semi-duplicate specifiers like struct and class (only difference is being private vs public by default, both of which already exist as dedicated keywords to serve this exact purpose), or typename and class in template definitions (whose few differences are slowly being removed even now). Then there's template specializations and metaprogramming as a whole, the Concepts spec being introduced in C++20, etc. It's all kind of a mess, really.
@x-seronis-x3 жыл бұрын
All things possess beauty. Its a matter of having the proper perspective
@anonanon30663 жыл бұрын
@@fastmovingvolcanomatter I agree. This whole template thing is one big shit show. You can write a function for arbitrary types, but only if you put the function body in-class. Oh, you want to put the code in the classes .cpp? Now you have to declare beforehand what types T should be, basically removing the point of templates... And now these concepts... Why couldn't I just do template T Add(T a, T b) { return a + b;} and the compiler would reject all instances where T does not have the dependent functions? Like, operator+... Why would I have to write a big mess of template requirements std::is_numeric, etc... All the information is there...
@RogueShadowTCN3 жыл бұрын
Don't be fooled! He keeps it on the simple side on purpose!
@arielespindola17593 жыл бұрын
C++ should be used and seen as a modern language these days... and yes, it is so elegant
@chrisroode3 жыл бұрын
I’m a completely self taught programmer, and this video did such a great job at filling in so many gaps! You are a great teacher!
@Meskalin_3 жыл бұрын
same!
@jakubpluhacek37793 жыл бұрын
Go do some codewars and look at people's solutions! They often use so many useful functions/objects from standard library and mostly explain why they do so.
@jkligel2 жыл бұрын
Well stated. Completely agree
@happygofishing Жыл бұрын
Although im studying networking, ive had no programming education so this is a greatly useful channel!
@NatalisYT3 жыл бұрын
You are truly one of the best teachers of programming and C++ around, we are all very fortunate to have you and I hope you continue to make beginner/intermediate videos like this to help make this nightmarish language more accessable to more people. Another great video, thank you!
@javidx93 жыл бұрын
Thanks Natalis, I will be occasionally doing more "entry level" videos, but also some of the silly projects too :D
@mrgeebee16223 жыл бұрын
I agree, this is really good to watch, and very pedagogic. Thank you Javidx9
@irbaboon19793 жыл бұрын
I had to learn this from a rudimentary data structures book with shoddy drawings and unsatisfactory input from my teacher in the mid 90’s - your explanations are much clearer. Although I haven’t done C/Cpp for years in my professional career I’m still enjoying the content. Keep it up!
@franciscogerardohernandezR19793 жыл бұрын
It's pure bliss when a pro coder goes back to explain basics. A C++20 tutorial using your pixel engine would be a beast. Regards and great work!
@saudude32093 жыл бұрын
As someone old enough to know how studying programming or just about any other science subjects looks like without youtube or udemy, I never forget to say that videos like this one and creators like you are a treasure. Even though I had successfully defended a cpp project for my engineering thesis, I have still remained at a cpp amateur/intermediate level, because of my laziness and lack of consistency in learning. I appreciate series like "Back To Basics" a lot. Thank you for providing high quality, in-depth lessons for us for free.
@pythagorasaurusrex98533 жыл бұрын
I watched a lot of your c++ videos so far. I have to say: Great job. I learned C++ way back in early 90ies but stopped programming about 20 years ago. Now I started to dig out my old C++ knowledge and re-learn C++ and I see how much C++ has evolved the last 20 years with all those new std:: features. Keep up your quality!
@markrobinson26483 жыл бұрын
I'm a C# developer who is learning C++ and your videos (particularly this one) are fantastic. Thank you for spending the time to create the videos.
@burntt9993 жыл бұрын
!!! javid you really are the man!!!! I always wanted to write something like this program in the video but wasn’t sure how to go about it. Now I can go over the program you wrote on this video line by line until I have it ingrained in memory.. jeez this channel is so incredible.
@TheButcher583 жыл бұрын
Your videos are really helpful in the sense that they do not provide a basic step by step tutorial how to implement a vector for example, but rather explain the background processes so that you understand why/when to choose a certain container type. I also like the fact that your video subjects are not necessarily related to each other but you pick a certain topic each time. This way you learn a lot of different things each video. Thank you for all the content you provide!
@JoshRosario3103 жыл бұрын
This is great, I learned C++ in 2005 and never touched it again until 15 years later. I never got into templates and with these containers there was a lot of syntax that made it look to me like a completely different language. I've been trying to find exactly this video with no real luck. I recently learned PHP and VB and thought the concept of a for..each was pretty nifty and wished I knew of a way in C++ back in the day! Great videos, I've been bingeing your content from the beginning over the last month.
@mokoko023 жыл бұрын
Hey just wanted to thank you for explaining these basic concepts in a ...well basic manner :) A lot of people online try to over-complicate things so your style of teaching helps me a lot.
@javidx93 жыл бұрын
Hey my pleasure buddy!
@obinator9065 Жыл бұрын
20:14 I’ve found that vectors crush linked lists in every single test at a higher element count, even insertion. If I pick a doubling capacity strategy (I believe GCC does this), I’ll make around 10 allocation and 10 memcpy() calls for the first 1000 items. The LinkedList will make a 1000, as this grows list will grow more inefficient in insertion time while the vector is crushing tests.
@xit12543 жыл бұрын
This is the best explanation of these mysterious C++ containers I've run across. I now believe I actually understand them.
@magisteriumemporium14113 жыл бұрын
Mr. Beautiful beard man strikes my heart again> THANK YOU FOR THIS. You are in my opinion one of the best, if not the best, people out there for content to watch. Thank you so much for what you have done for the community
@firepro203 жыл бұрын
I'm just getting started in C++ and your calm approach encourages me to learn more and not be afraid of the most complex / unforgiving programming language. Thank you and please continue making more videos! :D
@delqyrus26193 жыл бұрын
11:01 As a physicist i would say that a vector is an arrow. The general usage as some point is absolutely confusing and doesn't make much sense. Of course, an arrow can point on some point, but in general it points to the direction of some point.
@javidx93 жыл бұрын
And you would be correct. Vector is a dreadful name for this data structure.
@jorgeferreira67273 жыл бұрын
The "vector" took me by surprise. I really didn't expect it to be moving around so soon. I was watching just to review, as in "dusting out", some concepts, and maybe catching up with something new from the more recent C++ standards, and got kicked in the back by that old std::vector. Thank you for the inside details you show in your videos. After 30+ years there is still something to be learned.
@bumbarabun2 жыл бұрын
"I really didn't expect it to be moving around so soon." it is under your control, if you know in advance there would be much more elements - reserve capacity and it will not reallocate.
@davideriemma1803 жыл бұрын
The timing of this video is perfect: right when i needed. i feel like this is one of the channel that covers C++ and algorithm on a very detailed and easy to understand way! Thank you so much!
@ZeroCool22113 жыл бұрын
Man that's exactly what I need currently 👌🏼
@yusufklc78213 жыл бұрын
A new video about fundamentals. Thx javidx!
@kevinz19913 жыл бұрын
I appreciate that JAVID9X doesn’t like to “patronize” those who learn from him and appreciate how he empowers the coder to think about how the program runs for him or herself. With that being said... these “Back to basic” videos... especially the pointers tutorial and this containers tutorial... are extremely helpful in understanding even the most basic games on OLC if you are not a C++ wizard. I would highly recommend anyone reading this comment to go watch how the Tetris game is made and how the Tetris blocks are indexed. It makes even some of the most sophisticated games on OLC make sense to me. Anyways hope this helps someone cause I was really frustrated at first trying to learn this stuff, thank you so much javid9x
@javidx93 жыл бұрын
It's so important to learn how to debug, and the only way to do that is developing an understanding of what goes on behind the scenes. Digging yourself out of a hole is a really important programming skill.
@danieloliveira98153 жыл бұрын
Im a junior web dev and I don't understand most of your videos, but still I don't miss one because the way you explain is so entertaining :D
@Thinzy3 жыл бұрын
thank you so much for what you've provided us all with. Your explanations make everything so simple to understand
@seanmenzies19863 жыл бұрын
Fantastic video. "A deque is like a linked list of arrays". Light bulb moment! Thank you so much!
@DFPercush3 жыл бұрын
Any chance of getting into the C++20 stuff with concepts, coroutines, and piping operators?
@harishkulkarni72442 жыл бұрын
Thanks for the wonderful explanation on C++ containers. I have a minor comment at 6:12, operator[] of std::array doesn't do bound checking and the behaviour on accessing a non existent element is undefined. However at() member function does bound checking and throws an std::out_of_range exception if position is not within the range.
@thecakeredux3 жыл бұрын
This video is such a useful ressource. Immediate classic.
@mehtubbhai9709 Жыл бұрын
Loved your explanation on this topic. Please do more C++ back to basics videos. Good teachers like you are much appreciated. Cheers!
@arielespindola17593 жыл бұрын
It was posted four minutes ago, I haven’t watched it, and I already liked it!
@peter8813 жыл бұрын
My respect for people who disliked📉
@doriancorr Жыл бұрын
I've been a professional developer since the eighties. Your videos are all top notch. Kudos and I'm already a subscriber but I would have signed up with this one as well. Well done!
@javidx9 Жыл бұрын
Thanks Dorian!
@abhiz933 жыл бұрын
I had to learn vectors when I started to prepare for interviews. Even the most basic questions couldn't be done without vectors on HackerRank. Thanks for this primer! Much appreciated.
@CodingCardSharp3 жыл бұрын
Thank you for uploading this; it's a really useful resource on my own learning journey! I started C++ from scratch on a part-time basis in Sept 2020, and have basically been beasting arrays (of the 1D and multi-dimensional variety), loops, basic recursion, and some very simple classes/structs since. It was a linear learning process, including working out the 'easier' problem solving exercises. However, the next step up demands more...I dipped my toe in the murky waters of STL, and had it bitten off by some of the coding problems that demand their usage; so it's great to see the containers explained in a manner that sticks ice-cubes down the back of the learning fatigue that had set in. Your channel does for complicated programming concepts what something like 'Grokking Algorithms' did very for the far more elementary.
@WikiKar8 ай бұрын
16:39 I think that's exactly why we use .reserve(). It allows us to skip these reallocations if we, more or less. know what the size of a vector will be, or we know that there will be several items added to a vector in a sec so there's no point in setting capacity to default value.
@benjamink3 жыл бұрын
I program in C and hate C++ because it's so complex and has tons of features to learn, but I think after watching this video that it is actually possible. Great explanation and thanks
@scharpmeister3 жыл бұрын
Amazing. In the midst of losing my mind debugging this vector indexing problem, this just pops up in my recommendations👌🏻
@proud22beme3 жыл бұрын
this video is a godsend! i am self taught, so there is some knowledge gaps, prior to this i have mainly paid attention to time complexity, but the way you explain the memory allocation for each container is so good in this! learned a ton from it
@chiefthebeast93433 жыл бұрын
Thank you so much! I am teaching myself c++ and I am at vectors and you explained everything I am learning about in this one video!
@thebasicmaterialsproject18923 жыл бұрын
Nothing better than a bit of back to basics
@neefofway87463 жыл бұрын
I appreciate what you do Javid, I owe everything I know about c++ and programming in general to you. Keep it up brother!
@Artintrex3 жыл бұрын
I already have a good understanding of stl library but still this is the best explanation I've seen so far. Can't help but feel jealous of people learning them from you for the first time. Though I still prefer vector over deque; you can allocate a larger vector beforehand which also causes vector to grow by larger steps, also removing elements by moving the last element to the middle and doing a pop back solves the performance issue. Another tip is these containers do not automatically shrink, so a vector is pretty much just as fast as a regular array as long as you don't cause it to grow again.
@leanderperera8467 Жыл бұрын
Excellent overview of C++ containers and their internals and efficiency. Thank you.
@artemiasalina18606 ай бұрын
Thanks for mentioning the "auto for loop" technique! I wasn't aware of that and have just changed all the code in my project to use them. They work fine and look much nicer!
@Windeycastle Жыл бұрын
This was a great video! As a beginner, I've wondered how you should store multiple values in one variable. In Python, it's easy, but in C++ you have to choose what types fits your needs. I like it!
@computerprogrammer79423 жыл бұрын
He made this video at the right time when everybody needed it, what a genius!
@brucewayne24803 жыл бұрын
Great video ! I studied C++ a little bit at university and now I'm using javascript and typescript. Back to the basics is essential.
@jaitjacob Жыл бұрын
thank you for making such a comprehensive yet easy to understand video! you are a great teacher.
@TankorSmash3 жыл бұрын
14:15 to everyone wondering, he called his vector, container not the other way around. Threw me for a loop for a sec
@inlandchris12 жыл бұрын
Very good instructions. I use to hand make Link List in the mid 1990's and considered them extremely fast. Now, looks like all the hard work is pre-made making C++ a higher level programming language. I am very late as COVID delayed my programming works as I went to build some muscles instead. Thank you for this and look forward following you.
@thalescarl15893 жыл бұрын
Awesome video. I don't think we can find other content with this much quality on KZbin. Please make this a series explaining the basics for us.
@NormHen54133 жыл бұрын
These beginner level concepts are super helpful, thanks for posting Javid
@ArisAlamanos3 жыл бұрын
Yet another great video from an excellent channel! I admire your dedication and passion. Keep up the good work!
@nunyobiznez8753 жыл бұрын
Code::Blocks is fairly easy to setup and supports different compilers. It's a good IDE, and it also has tools for wxWidgets as well, which may also come in handy for you at some point as well.
@arnocr012 жыл бұрын
more back to basics please! you explain things so well. i wish i had your videos back in college instead of a dry textbook.
@qazarl3 жыл бұрын
12:45 vector actually tries to std::move your elements, unless they are trivially copyable or not noexcept movable :)
@geraltt14553 жыл бұрын
like your videos, they have philosophical atmosphere
@brendinventer64073 жыл бұрын
You really need to make a C++ game development course. Your teaching approach is so so good. Thank you!
@archie95003 жыл бұрын
Just what I needed when messing around with maps of bucketed linked lists!
@happyredmapleleaf3 жыл бұрын
Let’s goooo another video for my skill level XD
@anonanon30663 жыл бұрын
Thanks for providing this information for free!
@durrcodurr10 ай бұрын
What std::vector does, can easily be found out by reading its source code. Many implementations by default reallocate the vector for every element added at the end of the vector. The solution for this is to create your own vector scaling policy (for instance, automatic exponential scaling). This is done by using the capacity() and reserve() methods of the vector class. Since many programmers are oblivious to this, improperly written C++ code using the vector class can get really slow. Apparently, modern implementations (like for C++20) now finally use at least quadratic exponentiation when scaling up vectors.
@Finkelfunk Жыл бұрын
Can I just say that you are doing a fantastic job teaching these types of complex concepts? :)
@donnyp2 жыл бұрын
Clear and precise, thank you sir
@anouarbagent25113 жыл бұрын
this is one the those channels that you automatically leave a like in any of its videos without even thinking.
@cheaterman493 жыл бұрын
I'm only 10 mins in and already love the primer on modern C++, hahaha! So many things one doesn't know when they only learned C++98 :-)
@AntonioZL3 жыл бұрын
In the same way as Python is elegant due to it's simplicity, Cpp is elegant due to how precise it is. Beautiful language.
@ZizoAhmed3 жыл бұрын
Finally a video I can complete on this channel . xD
@jvsnyc3 жыл бұрын
I love ya already -- due to lexical coincidence, I accidentally thought your channel was about Java 9 with indexes, but now I know better! ~4:34, I would be careful about showing that as 'a + 17 * sizeof(int)' as due to pointer arithmetic, in C++ we would write that as simply 'a + 17' with the multiply by sizeof(int) being implicit. This isn't immediately obvious to those who don't come from a primarily C/C++ background, and could be forgotten by those who jump from language to language. That is, a[17] is always equivalent to *(a + 17) with no sizeof in sight, obvious to you and me, but something that can be forgotten to great detriment by beginners.
For me as a .NET developer switching to RAII C family your tutorials are very helpful. Thanks a lot)
@dahuskey813 жыл бұрын
Hey Mr. J, No this is not batman, but a big fan of your work. I am not a big fan of paying people for content, not that I am against it, just some of the stuff I really don't feel there is enough value to cough up hard earned money ..... Until I saw your channel. I enjoy watch it, not only for serious stuff, but your humor. People think think coders do not have a sense of humor ** insert robot picture here ** Because of you I am not going to have to make an account on Patreon, and "Yes, open up my checkbook" Gahhhh :) :) :) Keep up the good work man I love this stuff!! Now "Robin! To the Batcave!!"
@javidx93 жыл бұрын
Thank you for your kind words 😊
@77Zamien2 жыл бұрын
Great content! I have been learning C++ for a while and this was an excelent summary of the containers!
@GilFavor1013 жыл бұрын
At 13:00. NOOOO, I spent the last couple days working on a tic tac toe game using `std::vector` and putting smart pointers inside it! I had a feelling there was going to be a problem, I just didn't know what it would be, or when I would find it. I FOUND IT, lol. Okay, so I can initialize it to a fixed size. Might as well use std::array then though, I think. Love this, please do another "Back to Basics" : ) Edit: In case anyone is curious, my `std::vector` was to hold smart pointers to `player` objects, of which, the amount of players is set at the beginning prompts such as "How many players?" in the CLI. Edit 2: This video is so great, thank you for making this one!
@javidx93 жыл бұрын
Putting smart pointers in a vector is just fine. Having pointers to vector elements is risky.
@justasydefix62513 жыл бұрын
These videos are too precious! we must copy them into a vector.
@KingGrio3 жыл бұрын
Thanks ever so much Javid for this video. I have not been properly trained in C++ and I find a lot of KZbin tutorials provide contrived examples that do not really help understand when something is useful. Your videos always provide some context and I always feel like I got a clearer picture of how things work internally and what is and isn't good practice. Although because of my lack of knowledge it does take me a long time viewing your different videos to process all the information and finally "get it". If you ever have some time, I would be tremendously happy if you could break down the VST plugin framework for us. I have a lot of trouble understanding things like "extern C", or how virtual classes are used for versioning or inheritance, or how threads are started somewhere and how/where you should write code to pass your audio data to the plugin and so on.
@davidjulitz74462 жыл бұрын
In the "good old days", we implemented those containers by ourselves and often enough ended up in a mess. Good that modern C++ changed this. On the other hand to reinvent those containers might help to learn some bits. However, nice and helpful video.
@seditt51463 жыл бұрын
Standard Vector is a work of art people don't give credit to that it deserves. Once you dig in and really see what is inside and then see the absolutely tiny amount of code it gives you really start to appreciate it for what it is. It gives the ability to have an extremely flexible array and it takes hundreds if not thousands of lines of code in order to produce literally 10 lines or so of assembly for doing exactly what it was you were attempting to do. Unless someone has a specific use case in their mind they would be hard pressed to write a better implementation.
@ΤΛΞ3 жыл бұрын
I don’t even program in C++ but I watch all your videos because they are great
@tezza483 жыл бұрын
Fantastic video Javid :) I always pick up a few gems i didn't know!
@javidx93 жыл бұрын
Thanks Tezza!
@robwatson8263 жыл бұрын
That was a really interesting video and great to get some deeper understanding on how these data structures store their values, thanks for sharing!
@uzkjhgfdsewr3 жыл бұрын
What I'm learning here is less of STL-containers having weird consequences, I'm learning about pointers having weird consequences (so you should use them only if needed and only if encapsulatable).
@jgurtz3 жыл бұрын
Thanks for the great introduction to some standard containers!
@thomasjefferson62252 жыл бұрын
coming from python, and starting to learn c++.... this video made so much sense.
@GrandNebSmada3 жыл бұрын
Every time you have the idea to do a video like this, you should do it 1 week earlier, because we literally just went over linked lists in my CS class and this would have been really great to watch ahead of time haha. Great video as always!!
@JorgeLuis-ts6qp3 жыл бұрын
I have seen line 23 in 9:40 implemented as 𝚏𝚘𝚛( 𝚊𝚞𝚝𝚘 && 𝚒 : 𝚋) Why would I want to have a double pointer? Which iteration is better?
@Crystan3 жыл бұрын
I was genuinely surprised when I saw what happened at 16:20. The odds of it returning to its original spot must be close to a million to one.
@acho83873 жыл бұрын
I'm loving this! Many thanks!
@nathanbanks23542 жыл бұрын
After switching from Java/Python to C++ for a project, this is incredibly useful. Wish I watched it ages ago! It seems as if C++ is borrowing cool stuff from other languages, but the notation is super weird because it still has to be backwards compatible with C programs. I've never really missed the auto keyword in Java, though I do use Array instead of Array sometimes.
@jacopopecchini22672 жыл бұрын
THank you! this helped a lot understanding containers. I would also print che container's capacity, because for vectors it is interesting to see how it doubles every time the size hits the capacity limit.
@javidx92 жыл бұрын
Thanks, doubling is just one strategy that empirically turns out to be reasonably efficient. Different implementations may not always double.
@andrewphi49583 жыл бұрын
Wow! Your speech pace and tone are just great and reminded me of techmoan so much! ))
@manuelnovella393 жыл бұрын
Wow! I loved your video, really. Donald Knuth would be pretty happy, I think. More on data structures, please? Maybe going in depth on the use of sets and maps or covering trees and graphs? That'd be awesome. In my opinion, trees deserve a whole separate video
@lercenico82603 жыл бұрын
congrats on 256k subscribers ✌️
@Borkicorn3 жыл бұрын
love your work
@davifn66253 жыл бұрын
Correction: at around 4:20, a[7] actually points to the eighth element of the array instead of the seventh
@davifn66253 жыл бұрын
Also I don't see how the list container couldn't keep count of how many elements are in the list
@davidfrischknecht82613 жыл бұрын
@@davifn6625 It's implemented using a regular doubly-linked list. Each node only has the value itself and pointers to the previous and next nodes.
@davifn66253 жыл бұрын
@@davidfrischknecht8261, I know how it is implemented. I am just pointing out that there is no reason the implementation couldn't keep count of how many items there are in the list, as javid said
@javidx93 жыл бұрын
Its tricky because of the more advanced container operations. For example you can merge and splice lists, or sub lists and ranges, In these instances there is nothing describing how many nodes are in those sequences, yet the operation can complete without walking them (just through pointer adjustment of head and tail).
@davifn66253 жыл бұрын
@@javidx9, got it. Thanks for clarifying
@defaultdefault39953 жыл бұрын
At 8:40 line 13 would it be better, for large arrays at least, to hold b.size() in a variable and use it as a stop condition instead of calling b.size() for each iteration of the loop?
@Idlecodex3 жыл бұрын
CppCast?! Great crossover! I’m going to check that in 31’41”!
@gilleswalther59643 жыл бұрын
I don't know why these video are making me happy :-)
@H3liosphan3 жыл бұрын
This is great. Thanks! I 'learned' C++ in the mid 90s, pretty sure std::array, std::vector and std::deque weren't around then! Amazing modern improvements. mostly I used standard C and more lately C#, which appears to have many similarities to this, but I'd imagine is burdened more by MS and .NET added latencies. There's a reason the Unreal Engine was built in C++.
@n0handles3 жыл бұрын
This also was a great review on data structures. Thanks for another great video!
@nedelcucosmin30873 жыл бұрын
a good idea for the future it would be to talk a little bit about the complexities of adding/removing/accessing elements in the respective container