Thanks for watching! ❤️ Data is everywhere! Enhance your career and acquire new skills by taking a course on DataCamp! Click here to take the first chapter of any course for FREE: bit.ly/2ZrYE6O (you’ll be supporting my channel too!)
I'm a fairly seasoned C++ developer, having been using it since 2000. I enjoy your videos simply because I like to know how things are being taught today, and I like having a window into the game development world. Watching other people write and talk about code is also helpful for motivation!
I once had an interview at 343 and one of the questions the interviewers asked me was to write an iterator for a tree data structure. Up to that point, I had never written an iterator in C++ not to mention for a less common DS, so I struggled through it. Didn't get the job but I remember the experience. Those who are watching - learn this! It may help land you a job in the industry. Thank you for this video - I found both the thought process and the code exercise useful!
Happened to me too a few days ago when interviewing for NVIDIA. Had to write an iterator for a linked list class but had no idea about how to write iterators :(
Funny I just did an exam where I wished I had more knowledge on iterators and then decided to try and find more resources. Lo and behold! New video from the Cherno on iterators.
"2:51 I pull my Heart and soul into my Videos " Words uttered from your subconcious mind, your efforts, burning desire towards tech. will take yoiu a long way, I watched couple of your videos, I'm so impressed by the way you deliver. Bridge the gap between a novice developer and an architect. I can see you there. God bless you Cherno.
I'm all for reading code to learn, but my god, the STL seems like it was written as part of a contest to see who could write the most obfuscated and difficult to understand code.
Thanks for your videos, always nice to watch! Question: why implement VectorIterator instead of Iterator as a nested non-templated class in Vector? Is it because you could technically reuse it for another Array class (or any other random access container)?
I would love a video about Iterators with a complex type, like a graph (a tree or something like hat). Everything in this video was easy, but what do you do, if you have to make a decision in the operator++? E.g. go to the child element or to a neighbor? And how do you track, which decision you made where? Lets say you go to the childs first, then you have to get the first neighbor after the last child. How do I do this, without creating a very complex iterator that has to track everything somehow?
Thanks Cherno - this is a nice "quick and dirty" implementation. For people interested to make solid safe real versions of the nice example here you must also: 1. add some protective code to prevent the increment/decrement operators from running off the ends of the array. 2. Decide how you want to handle dereferencing an iterator that is "invalid" (as well as pointer access). With a little work to tidy it up you can have a safe version. Mine currently will stop decrementing and "stay" on the first valid array value if you try to decrement off the end. I'm still thinking about best approaches and may test out the std behavior and just mimic same behaviors.
Also - implementing the operator[ ] on the iterator itself is not conventional and would be confusing IMO. There's likely an operator [ ] on your container "itself" if it makes sense for that kind of container
Thank you so much for your amazing lectures. Would you please make an introductory lecture on Boost Library? Where should we use it? Also please make a video on different ways to design the code architecture in different types of large projects. Like thread based, or state machines based etc. Lastly, the c++ coding standards. I couldn't find good content on these topics so far. Thanks.
I actually wrote my own vector class a couple of years ago and had the exact same issue with non primitive types. Took ages to figure out what was going wrong :D
Thanks for clear explanation and I tried implementing the customer iterator. I feel happy. Now I am able to understand the backends of STLs in effective manner. Thanks a lot. Please do post video for internal implementation of Maps, Multimap
one day I was struggling with template argument lists, so I just opened the std::thread implementation in Visual Studio and copypasted a lot of code, tinkering with it. It helped a lot in understanding reference forwarding, storing arg lists in tuples and then invoking callbacks from that tuples. And now I've even managed to make a constrained template tuple-based hash-table for passing some data to the lua-machine.
I usually try to check the standard libraries, but all the macros, debug, fancy underscores... it all just makes it confusing. So thanks for decrypting it.
People just don't usually send me some good code they made to solve some industry problem that is at all readable. I'm not saying one of those things don't happen in the chain of events, none of those things exist in my life. So as a beginner I'm slightly lacking the source. And often times it also happens that you're trying to find a syntax for a simple problem you're trying to solve and think you know the way logically, but you're missing the correct syntax, and you find stack overflow doing some crazy convoluted method to what can be solved with a short line of code. I'm at the level where I've never had to allocate to heap even though I've learned to do that. It's not quite the tools missing but applications. For most of my uses I'm interested in collecting a bit of information from the user or file, then operating on them and printing the results out. The biggest interest often is "how do I do this arithmetic operation chain in compact length with efficiency". Or "how on earth will I 1. make a matrix and print it 2. solve making an intuitive interface for inputing a matrix in prompt 3. do matrix calculations without writing painstaking manual element by element chain of loops or picking elements by hand 4. how do I generalize it for more than my template size matrix" etc. Your operator overload (conveniently as a demonstration of x, y, z struct that represented a vector) solved the printing for virtually any custom class neatly inside the code. Also I saw a compact method from std libraries to sum the rows together as if you did M*(1, 1, 1) matrix calculation similar to some example exercises on vector math classes. But I also saw a demonstration of how you'd do nxn matrix multiplied with nxn matrix and got upset at like 5 nested for loops that you'd manually make to iterate through everything in the matrix (supposedly making it like 100 times slower than individual arithmetic operations would predict due to the way of using cache). This is just semantics or philosophical pondering, not personally aimed to criticize or anything like that (all the videos are highly helpful) but don't you find it funny to state that most students have the issue of relying on documentation and videos when they should be reading real code and how the standard library does things, and also saying that when you wrote an iterator, you hadn't been taught it. In a video you released to demonstrate to people how to do it and giving tools to write and make things with code. I agree that you're correct in what you say, but what you do is immensely helpful, because I barely have time to sleep in engineering school and I assure you, learning C++ past very basics that allows you to write simple crude programs to maybe help you with some school tasks is not the priority. Without these videos I either wouldn't get a better understanding on C++ or I'd spent most of my time trying to understand stuff like CPPreference and bang my head against the wall to try to get some things to work and get no school work and studying done. Lastly after all the rambling, I must say I love the hue of orange your Visual Studio has. I'm using VS Code because it seemed like the best combo for me: doesn't take ages to open up and seemingly have a lot of weight pulled around when you try to use it, but similar enough to Visual Studio with all the convenient editing help and tools. However it has in some sense quite pastel, light and faded. And I'm really struggling to customize it for now, there's no color map outside the template themes where you could just choose the type of thing to color and choose the color, it just throws you in an empty .json to write your own definitions in who knows what syntax. That's a future project, to make it look pleasantly vivid like your Visual Studio. Funnily enough VSC made sure I noticed from the coloring of the words that there was a } missing where you had it, everything was just grey instead of the variable colors because it would no longer declare the m_Data, m_size and m_Capacity.
why Vector::ValueType is used .I don't understand the syntax .I mean I only know that Classname::something is used when something is static in that class.Can anyone please explain that to me.thank you very much!
Hey man! First I wanted to tell you, that I really appreciate your tutorials man! But my question to the typenames is: Why do you have to create always a new pair of shoes? For example ... ReferenceType = T& Why not just typing T over and over again? Or has it something to do with the inheritance of classes? Thank you for your answer already! :-) And, even though Corona shatters the normal life: Merry Christmas!
My understanding is that the Vector::ValueType is a templated type defined when the template is instantiated. The iterator relies on the typename specifically, not the type. Therefore, the 'typename' keyword is necessary to ensure that the iterator and the container the iterator is working on is in sync. Search 'C++ typename' for further details.
@@Raspredval1337 I'm not sure I understand the question - what is the point of the iterator or the 'using' statement that syncs the iterator to its related template's contained class?
HI, thanks for the neat tutorial! There's one minor bug in your prefix operator implementation - is implemented in terms of a postfix operator, should be ++m_Ptr instead of m_Ptr++; Cheers
That was a pretty good intro to iterators, as well as how to use them for enumerating data types. I do wish that you'd have kept the _NODISCARD macros intact as well as all the const mechanisms that the MSVC implementation provides as they can help catch problems early on as well as increase performance. But again, entry-level, I understand why most of that stuff was omitted. I hope that you, the person reading this whomever you may be, are doing well.
I think its a terrible intro, hes jumping around all over the place of existing code without explaining anything really. "Lets make this a template" and gives no insight as to why, its pretty much copy and paste stuff and poorly done as a stand-alone video. Get the impression her doesnt fully understand them himself but is just making it work.
@@SumoCumLoudly gotta fully agree with you, this has to be the first vid i've seen where cherno actually seems to be copy pasting stuff without actually getting what is going on under the hood. Shameful display tbh.
why dont you realocate memory in Vector class by some magic like memcpy and just call operator delete( ptr, ...) later , it will assume the ptr you pass in is a void pointer so it will not call the destructor anyway
I can never thank you enough for your work on this series. I wanted to ask something, at 16:33, about the postfix operator. Shouldn't you make operator++(int) returning const VectorIterator instead of just VectorIterator, to prevent users from concatenating them like it++++? Since returning a const VectorIterator, you'd disable all non-const methods, making any subsequent ++ illegal. Not sure if the same logic applies to the prefix operator...
I once wrote a unified style iterator that works for all data structures but it needed some functions to be implemented in the data structures. What's the advantage of a specific iterator over a common iterator?
Iterators do not nessesarily belong to containers. You can write iterators to implement infinite/lazy datastructures. The simplest example I came up with is the numeric range, like pythons range: struct NumberIterator { int i; NumberIterator& operator++() { ++i; return *this; } constexpr int operator*() const { return i; } constexpr bool operator!=(NumberIterator const& other) { return i != other.i; } }; struct Range { int a, b; constexpr NumberIterator begin() const { return {a}; } constexpr NumberIterator end() const { return {b}; } }; int main() { for(int i : Range{1, 6}) { std::cout
quick question chenro, how do you get that color theme for your Visual studio. Mostly how do you change the colour of clases and strucutres. I unfortunately have to use Visual Studio at work instead of VS code so I'm a bit lost. I find that changing the colours really helps me keep track of what my code is doing.
I'm a beginner ,and i'm far behind with the vids but i wanted to ask you if you could show us how can we implement all the things you showed us in the proces of making a simple game.
You can use std::construct_at() or something similar instead of placement new, it looks cleaner. Could you make a video for how to implement a property class without any overhead ?
Nevermind, I thought about it for about a year and realized that there are some instances in which objects can't be constructed in-place (e.g. returned from a function from an external library), or it's simply not worth it (e.g. for primitive types).
Have someone tried alternatives to std library and compare performance and compile times? AFAIK it's much faster in gcc/clang debug builds than in msvc, cause msvc version does many checks in debug and some of them are (i think) even locking some mutexes. But there are other implementations such as eastd
For the second channel could you react to the 13 min Black myth: Wukong. The game looks very advanced. It’s like next gen of next gen. I think other people may be wanting to see this game as well in the perspective of someone like you. I don’t mind if you don’t do it though I will still love you content.
grrrr, can you use a pastebin and paste the code in there, place the link in the discription, i can't follow you and type it over, you're going to fast up & down. Qt Creator has the GNU ISO C++ Library.
It's better to stick to naming conventions of STL/boost and use value_type, reference, pointer, etc., so your custom containers could interoperate with them.
Finally, I've done iterator over my custom collection of indexable history items. As I couldn't use the pointer alone, because it wouldn't work with my collection ordering, I used the iterator that gets the index in constructor. Works as charm, it iterates from most recently added items, can also be reused with different indexable collections. Is there a neat syntax to use the same iterator to iterate backwards in C++17?
Isn't the operator!= a bug? First you compare this.m_Ptr in the == overload member vars, then in the != you compare this with other? Isn't it more safe to always use a previously created method and just invert it (if invertable)? Such as you did with increment operators?
He is exactly using the previously created operator== method to code the operator!=. The following two definition of operator!= will be equivalent, IF the operator== has been defined: 1.) m_Ptr != other.m_Ptr 2.) !(this == other)
nope, and for a good reason. Iterators are designed to be a black box over indexing container's elements. And it's up to the user to provide one, which is more suitable for the use case
Well, I've watched this video without watching the "making vector class" video and that piece of Vector::ReAlloc function you showed here looks like some elvish magic :D
Thanks for watching! ❤️ Data is everywhere! Enhance your career and acquire new skills by taking a course on DataCamp! Click here to take the first chapter of any course for FREE: bit.ly/2ZrYE6O (you’ll be supporting my channel too!)
I first learned programming through DataCamp. Great sponsor!
When I learn all C++17 features, C++34 going to be released.
I don’t understand all that your saying, just what I can understand
First time?🌚😂
Same
Don't have to worry, there isn't going to be a C++34, it will be C++35 😂
I'm a fairly seasoned C++ developer, having been using it since 2000. I enjoy your videos simply because I like to know how things are being taught today, and I like having a window into the game development world. Watching other people write and talk about code is also helpful for motivation!
Lol! I was born in 2001. How old are you?
@@godnyx117 now a year older than back when you asked :V
@@AlFredo-sx2yy Lol, you are not wrong!
@@AlFredo-sx2yy now 2 years...
I once had an interview at 343 and one of the questions the interviewers asked me was to write an iterator for a tree data structure. Up to that point, I had never written an iterator in C++ not to mention for a less common DS, so I struggled through it. Didn't get the job but I remember the experience. Those who are watching - learn this! It may help land you a job in the industry.
Thank you for this video - I found both the thought process and the code exercise useful!
Did you actually interview at 343? The 343. That's cool, even if you did not get the job.
Of course you didn't got the job! There is a reason people call them 343tard!
Happened to me too a few days ago when interviewing for NVIDIA. Had to write an iterator for a linked list class but had no idea about how to write iterators :(
Funny I just did an exam where I wished I had more knowledge on iterators and then decided to try and find more resources. Lo and behold! New video from the Cherno on iterators.
comp6771?
What did you get on the exam? Just curious see how well Cherno has taught you.
@@StevenQiang Watching this video for my assignment 2
@@jyliang2987 Good luck with your assignment😆
I always love when you explain library code
"2:51 I pull my Heart and soul into my Videos " Words uttered from your subconcious mind, your efforts, burning desire towards tech. will take yoiu a long way, I watched couple of your videos, I'm so impressed by the way you deliver. Bridge the gap between a novice developer and an architect. I can see you there. God bless you Cherno.
I love how you actually think about our learning experience and worry about it as a mentor would. Love you man. Keep up the great work!
Exactly what I was waiting for. Thanks, Cherno! Waiting for more C++ DS Videos!
I'm all for reading code to learn, but my god, the STL seems like it was written as part of a contest to see who could write the most obfuscated and difficult to understand code.
Haha just got to the part where you mentioned this yourself
Thanks for your videos, always nice to watch! Question: why implement VectorIterator instead of Iterator as a nested non-templated class in Vector? Is it because you could technically reuse it for another Array class (or any other random access container)?
I was wondering this too.
dude you are awesome , thanks , i needed you , and you came to me. so grateful
Thanks; this was really useful and straight to the point.
I would love a video about Iterators with a complex type, like a graph (a tree or something like hat). Everything in this video was easy, but what do you do, if you have to make a decision in the operator++? E.g. go to the child element or to a neighbor? And how do you track, which decision you made where? Lets say you go to the childs first, then you have to get the first neighbor after the last child. How do I do this, without creating a very complex iterator that has to track everything somehow?
Thanks Cherno - this is a nice "quick and dirty" implementation. For people interested to make solid safe real versions of the nice example here you must also: 1. add some protective code to prevent the increment/decrement operators from running off the ends of the array. 2. Decide how you want to handle dereferencing an iterator that is "invalid" (as well as pointer access). With a little work to tidy it up you can have a safe version. Mine currently will stop decrementing and "stay" on the first valid array value if you try to decrement off the end. I'm still thinking about best approaches and may test out the std behavior and just mimic same behaviors.
Also - implementing the operator[ ] on the iterator itself is not conventional and would be confusing IMO. There's likely an operator [ ] on your container "itself" if it makes sense for that kind of container
You've just explained this in shortest possible way for me. It works ! THX. I'd post a link to godbolt but youtube .....
Thank you so much for your amazing lectures. Would you please make an introductory lecture on Boost Library? Where should we use it?
Also please make a video on different ways to design the code architecture in different types of large projects. Like thread based, or state machines based etc.
Lastly, the c++ coding standards.
I couldn't find good content on these topics so far. Thanks.
Search for Bo Qian in youtube. Cherno + Bo Qian are one of the best C++ channels out there. Bo Qian covers the topics you asked for.
I've been waiting for this video for quite a while. Thank you Cherno!
I actually wrote my own vector class a couple of years ago and had the exact same issue with non primitive types. Took ages to figure out what was going wrong :D
Thanks for clear explanation and I tried implementing the customer iterator. I feel happy. Now I am able to understand the backends of STLs in effective manner. Thanks a lot. Please do post video for internal implementation of Maps, Multimap
one day I was struggling with template argument lists, so I just opened the std::thread implementation in Visual Studio and copypasted a lot of code, tinkering with it. It helped a lot in understanding reference forwarding, storing arg lists in tuples and then invoking callbacks from that tuples. And now I've even managed to make a constrained template tuple-based hash-table for passing some data to the lua-machine.
I usually try to check the standard libraries, but all the macros, debug, fancy underscores... it all just makes it confusing. So thanks for decrypting it.
2:50 this is incredibly helpful as an aid for a uni course, for me at least; very helpful
Great as always. Much love.
There are no subtitles in this issue. If you can cherno, thank you for adding it.
People just don't usually send me some good code they made to solve some industry problem that is at all readable. I'm not saying one of those things don't happen in the chain of events, none of those things exist in my life. So as a beginner I'm slightly lacking the source. And often times it also happens that you're trying to find a syntax for a simple problem you're trying to solve and think you know the way logically, but you're missing the correct syntax, and you find stack overflow doing some crazy convoluted method to what can be solved with a short line of code.
I'm at the level where I've never had to allocate to heap even though I've learned to do that. It's not quite the tools missing but applications. For most of my uses I'm interested in collecting a bit of information from the user or file, then operating on them and printing the results out. The biggest interest often is "how do I do this arithmetic operation chain in compact length with efficiency". Or "how on earth will I 1. make a matrix and print it 2. solve making an intuitive interface for inputing a matrix in prompt 3. do matrix calculations without writing painstaking manual element by element chain of loops or picking elements by hand 4. how do I generalize it for more than my template size matrix" etc.
Your operator overload (conveniently as a demonstration of x, y, z struct that represented a vector) solved the printing for virtually any custom class neatly inside the code. Also I saw a compact method from std libraries to sum the rows together as if you did M*(1, 1, 1) matrix calculation similar to some example exercises on vector math classes. But I also saw a demonstration of how you'd do nxn matrix multiplied with nxn matrix and got upset at like 5 nested for loops that you'd manually make to iterate through everything in the matrix (supposedly making it like 100 times slower than individual arithmetic operations would predict due to the way of using cache).
This is just semantics or philosophical pondering, not personally aimed to criticize or anything like that (all the videos are highly helpful) but don't you find it funny to state that most students have the issue of relying on documentation and videos when they should be reading real code and how the standard library does things, and also saying that when you wrote an iterator, you hadn't been taught it. In a video you released to demonstrate to people how to do it and giving tools to write and make things with code. I agree that you're correct in what you say, but what you do is immensely helpful, because I barely have time to sleep in engineering school and I assure you, learning C++ past very basics that allows you to write simple crude programs to maybe help you with some school tasks is not the priority. Without these videos I either wouldn't get a better understanding on C++ or I'd spent most of my time trying to understand stuff like CPPreference and bang my head against the wall to try to get some things to work and get no school work and studying done.
Lastly after all the rambling, I must say I love the hue of orange your Visual Studio has. I'm using VS Code because it seemed like the best combo for me: doesn't take ages to open up and seemingly have a lot of weight pulled around when you try to use it, but similar enough to Visual Studio with all the convenient editing help and tools. However it has in some sense quite pastel, light and faded. And I'm really struggling to customize it for now, there's no color map outside the template themes where you could just choose the type of thing to color and choose the color, it just throws you in an empty .json to write your own definitions in who knows what syntax. That's a future project, to make it look pleasantly vivid like your Visual Studio. Funnily enough VSC made sure I noticed from the coloring of the words that there was a } missing where you had it, everything was just grey instead of the variable colors because it would no longer declare the m_Data, m_size and m_Capacity.
Could someone explain me what the scope resolution operator :: is doing before the call of some operator() functions? Like ::operator new()
Check out placement new and placement delete, it allows for separation of allocation and construction of an object
How I taught myself to code was to find some code examples then hack it apart to do what I wanted. Lots of headaches and lots of yahoos with that lol
Does anyone know if he shares the code to the public and where that is? Thanks!!
Hi Cherno. Kudos from cape verde. Please make a series on popular projects code walktrough
That keyboard typing is just soo satisfying
Question: If we don't write "using ValueType = T" in the Vector class, is there any way for us to use Vector::T in the VectorIterator class?
why Vector::ValueType is used .I don't understand the syntax .I mean I only know that Classname::something is used when something is static in that class.Can anyone please explain that to me.thank you very much!
Same question
Hey man!
First I wanted to tell you, that I really appreciate your tutorials man!
But my question to the typenames is:
Why do you have to create always a new pair of shoes?
For example
...
ReferenceType = T&
Why not just typing T over and over again?
Or has it something to do with the inheritance of classes?
Thank you for your answer already! :-)
And, even though Corona shatters the normal life:
Merry Christmas!
Hello, I am not expert at the topic, but I think it just makes the code more readable (probably not for everyone though). Have a good day!
Can anyone explain why at 11:24 he has use
using ValueType = typename Vector::ValueType ??
Why we can't use
using ValueType = Vector::ValueType
I have no idea, but you kind of just do, the compiler will throw an error and tell you to put typename.
My understanding is that the Vector::ValueType is a templated type defined when the template is instantiated. The iterator relies on the typename specifically, not the type. Therefore, the 'typename' keyword is necessary to ensure that the iterator and the container the iterator is working on is in sync.
Search 'C++ typename' for further details.
@@mequint2000 idk, if the only practical way of getting the iterator is using begin/end/find, the type is already instantiated, so what's the point?
@@Raspredval1337 I'm not sure I understand the question - what is the point of the iterator or the 'using' statement that syncs the iterator to its related template's contained class?
How about linked lists (std::list) next? I would really like to see how iterators would work with data structures such as lists😅...
please do a DS full series 😍😍
Great Video! Is your VS color scheme somewhere available for download? Really like it
Long time no see 😂
You have a backlog of c++ topics you have to catch up man 🙂
HI, thanks for the neat tutorial! There's one minor bug in your prefix operator implementation - is implemented in terms of a postfix operator, should be ++m_Ptr instead of m_Ptr++;
Cheers
That was a pretty good intro to iterators, as well as how to use them for enumerating data types. I do wish that you'd have kept the _NODISCARD macros intact as well as all the const mechanisms that the MSVC implementation provides as they can help catch problems early on as well as increase performance. But again, entry-level, I understand why most of that stuff was omitted.
I hope that you, the person reading this whomever you may be, are doing well.
I think its a terrible intro, hes jumping around all over the place of existing code without explaining anything really. "Lets make this a template" and gives no insight as to why, its pretty much copy and paste stuff and poorly done as a stand-alone video. Get the impression her doesnt fully understand them himself but is just making it work.
@@SumoCumLoudly gotta fully agree with you, this has to be the first vid i've seen where cherno actually seems to be copy pasting stuff without actually getting what is going on under the hood. Shameful display tbh.
why dont you realocate memory in Vector class by some magic like memcpy and just call operator delete( ptr, ...) later , it will assume the ptr you pass in is a void pointer so it will not call the destructor anyway
I can never thank you enough for your work on this series.
I wanted to ask something, at 16:33, about the postfix operator. Shouldn't you make operator++(int) returning const VectorIterator instead of just VectorIterator, to prevent users from concatenating them like it++++? Since returning a const VectorIterator, you'd disable all non-const methods, making any subsequent ++ illegal. Not sure if the same logic applies to the prefix operator...
No problem with (i++)++ or (++i)++ or i+=2
I love it, I just have to watch it at 0.75x, my brother, you are talking super fast.
I once wrote a unified style iterator that works for all data structures but it needed some functions to be implemented in the data structures. What's the advantage of a specific iterator over a common iterator?
Iterators do not nessesarily belong to containers. You can write iterators to implement infinite/lazy datastructures. The simplest example I came up with is the numeric range, like pythons range:
struct NumberIterator {
int i;
NumberIterator& operator++() {
++i;
return *this;
}
constexpr int operator*() const {
return i;
}
constexpr bool operator!=(NumberIterator const& other) {
return i != other.i;
}
};
struct Range {
int a, b;
constexpr NumberIterator begin() const {
return {a};
}
constexpr NumberIterator end() const {
return {b};
}
};
int main() {
for(int i : Range{1, 6}) {
std::cout
Coming from Rust, implementing Iterators is kind of the same thing, but in Rust it feels like a bit better integrated into the language.
Playback Speed = 0.75, and you will understand every thing.
quick question chenro, how do you get that color theme for your Visual studio. Mostly how do you change the colour of clases and strucutres. I unfortunately have to use Visual Studio at work instead of VS code so I'm a bit lost. I find that changing the colours really helps me keep track of what my code is doing.
Whats up with indexing on the iterator? What's that useful for?
I'm a beginner ,and i'm far behind with the vids but i wanted to ask you if you could show us how can we implement all the things you showed us in the proces of making a simple game.
most compilers want: for(unsigned long i = 0; i < values.size(); i++)
step aside noob. we gotta needlessly overcomplicate this for no reason. i want those compile times DOUBLED!
Hello Cherno your videos are great. Also it would be great if you can possibly post some videos on Design patterns and Data Structures.
WHere is the source code?
It is impossible to follow going up and down the page.
Can someone please share the link where implementation of vector or for that matter entire STL can be found.
Thanks Cherno, It was really a good learning experience
You can use std::construct_at() or something similar instead of placement new, it looks cleaner. Could you make a video for how to implement a property class without any overhead ?
Is there any reason not to just use emplace_back all the time, since it’s more efficient?
Nevermind, I thought about it for about a year and realized that there are some instances in which objects can't be constructed in-place (e.g. returned from a function from an external library), or it's simply not worth it (e.g. for primitive types).
hi are you going to make video about the newer iterator introduced in cpp20 ? i mean with tags and everything
Does anybody has the source code for this? Reading the STL gives me a headache.
Have someone tried alternatives to std library and compare performance and compile times?
AFAIK it's much faster in gcc/clang debug builds than in msvc, cause msvc version does many checks in debug and some of them are (i think) even locking some mutexes.
But there are other implementations such as eastd
Godbless RUclips's playback speed option
Please make a video on allocator's !!!
Would you put source file here please or any link to the source file, please?
Hey Cherno! What's your C++ book recommendation?
11:55 How m_data pointer of Vector class is stored in Vector Iterator class
What is theme he is using for VS?
Finally bug with missing placement new fixed (I pointed it under Vector video).
For the second channel could you react to the 13 min Black myth: Wukong. The game looks very advanced. It’s like next gen of next gen. I think other people may be wanting to see this game as well in the perspective of someone like you. I don’t mind if you don’t do it though I will still love you content.
the cherno
grrrr, can you use a pastebin and paste the code in there, place the link in the discription, i can't follow you and type it over, you're going to fast up & down.
Qt Creator has the GNU ISO C++ Library.
It's better to stick to naming conventions of STL/boost and use value_type, reference, pointer, etc., so your custom containers could interoperate with them.
this video's not getting captions 😂,well i'll take it as an exercise
Finally, I've done iterator over my custom collection of indexable history items. As I couldn't use the pointer alone, because it wouldn't work with my collection ordering, I used the iterator that gets the index in constructor. Works as charm, it iterates from most recently added items, can also be reused with different indexable collections. Is there a neat syntax to use the same iterator to iterate backwards in C++17?
that is Microsoft standard library
FINALLY.
2:02
"keyboard exercises"
What theme is he using in Visual Studio? I want that so badly
Hes using visual assist which is a paid add on for visual studio
@@B1ankeys I mean the code style. I know that it can be his own custom style, but maybe someone knows, where to get something simillar
Hi, is there any other way to open/find that vector class file, because I don't use visual studio, thanks in advance.
your compiler typically has the std::lib headers in it's include directory somewhere in the compiler files, try searching there
Hey Cherno, can you recommend me a laptop under 100k rupees?
Isn't the operator!= a bug? First you compare this.m_Ptr in the == overload member vars, then in the != you compare this with other? Isn't it more safe to always use a previously created method and just invert it (if invertable)? Such as you did with increment operators?
He is exactly using the previously created operator== method to code the operator!=.
The following two definition of operator!= will be equivalent, IF the operator== has been defined:
1.) m_Ptr != other.m_Ptr
2.) !(this == other)
That's too hard to understand. Couldn't you do everything from scratch and not switch files so much?
Could someone please tell me which font and theme is he using?
Thanks in advance.
Probably consolas, and some dark theme.
The command and conquer code base was released open source, maybe you could do a video series on it, walking us through it.
Does C++ have any inbuilt mechanism to add iterator support to user defined structures?
nope, and for a good reason. Iterators are designed to be a black box over indexing container's elements. And it's up to the user to provide one, which is more suitable for the use case
Helpful? The standard way to learn C++ is to read textbooks and watch The Cherno videos
Nice
I have never seen that episode up their, Have you
the chern
asking someone to read stl code is something i wouldn't wish to my worst enemy
hi
Well, I've watched this video without watching the "making vector class" video and that piece of Vector::ReAlloc function you showed here looks like some elvish magic :D
great video,what the name of your theme thoXD
how long have you been doing this "hey what's up guys" with the hands? It's pretty cool :)
Great 😙😙😙😙😙
Hello! It's very interesting but your speech is very fast and it is hard to understand for not native speakers, please speak more slowly :)
Ah yes, msvc is simple !!!!!!!!!!
.
Hey Yan
wtf just happened?