Writing an ITERATOR in C++

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • 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!)
    Patreon ► / thecherno
    Instagram ► / thecherno
    Twitter ► / thecherno
    Discord ► thecherno.com/...
    Series Playlist ► thecherno.com/cpp
    This video is sponsored by DataCamp.

КОМЕНТАРІ • 165

  • @TheCherno
    @TheCherno  4 роки тому +37

    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!)

    • @phoenixjauregui5508
      @phoenixjauregui5508 4 роки тому +2

      I first learned programming through DataCamp. Great sponsor!

  • @muhammedyasinhanyasar539
    @muhammedyasinhanyasar539 3 роки тому +202

    When I learn all C++17 features, C++34 going to be released.

    • @lapatatadelplato6520
      @lapatatadelplato6520 2 роки тому +3

      I don’t understand all that your saying, just what I can understand

    • @LOL-cp6js
      @LOL-cp6js Рік тому +1

      First time?🌚😂

    • @mihevoct5624
      @mihevoct5624 Рік тому

      Same

    • @Delllatitude7490
      @Delllatitude7490 Місяць тому

      Don't have to worry, there isn't going to be a C++34, it will be C++35 😂

  • @lainproliant
    @lainproliant 4 роки тому +70

    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!

    • @godnyx117
      @godnyx117 3 роки тому +2

      Lol! I was born in 2001. How old are you?

    • @AlFredo-sx2yy
      @AlFredo-sx2yy 2 роки тому +1

      @@godnyx117 now a year older than back when you asked :V

    • @godnyx117
      @godnyx117 2 роки тому +2

      @@AlFredo-sx2yy Lol, you are not wrong!

    • @roeetoledano6242
      @roeetoledano6242 8 місяців тому

      @@AlFredo-sx2yy now 2 years...

  • @mequint2000
    @mequint2000 4 роки тому +51

    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!

    • @NordicFrog
      @NordicFrog 3 роки тому +2

      Did you actually interview at 343? The 343. That's cool, even if you did not get the job.

    • @godnyx117
      @godnyx117 3 роки тому

      Of course you didn't got the job! There is a reason people call them 343tard!

    • @dhruvgupta8747
      @dhruvgupta8747 3 роки тому +1

      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 :(

  • @davidb4020
    @davidb4020 4 роки тому +56

    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.

    • @StevenQiang
      @StevenQiang 4 роки тому +1

      comp6771?

    • @Sami-df7dj
      @Sami-df7dj 4 роки тому +1

      What did you get on the exam? Just curious see how well Cherno has taught you.

    • @jyliang2987
      @jyliang2987 Рік тому +1

      @@StevenQiang Watching this video for my assignment 2

    • @StevenQiang
      @StevenQiang Рік тому

      @@jyliang2987 Good luck with your assignment😆

  • @jessprogany4345
    @jessprogany4345 3 роки тому +16

    I always love when you explain library code

  • @PwnySlaystation01
    @PwnySlaystation01 4 роки тому +18

    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.

    • @PwnySlaystation01
      @PwnySlaystation01 4 роки тому +3

      Haha just got to the part where you mentioned this yourself

  • @kryt7955
    @kryt7955 Рік тому +2

    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!

  • @sathyababu9130
    @sathyababu9130 2 роки тому +3

    "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.

  • @mockingbird3809
    @mockingbird3809 4 роки тому +5

    Exactly what I was waiting for. Thanks, Cherno! Waiting for more C++ DS Videos!

  • @joymakerRC
    @joymakerRC Рік тому +1

    dude you are awesome , thanks , i needed you , and you came to me. so grateful

  • @joachimhodara575
    @joachimhodara575 3 роки тому +22

    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)?

  • @Devilextremeful
    @Devilextremeful Рік тому +1

    Thanks; this was really useful and straight to the point.

  • @LetsDark
    @LetsDark 3 роки тому +2

    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?

  • @isaactong3054
    @isaactong3054 4 роки тому

    I've been waiting for this video for quite a while. Thank you Cherno!

  • @lukasz_kostka
    @lukasz_kostka 2 роки тому

    You've just explained this in shortest possible way for me. It works ! THX. I'd post a link to godbolt but youtube .....

  • @ibraheeminam4982
    @ibraheeminam4982 4 роки тому +3

    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.

    • @krisitak
      @krisitak 4 роки тому +3

      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.

  • @mario7501
    @mario7501 4 роки тому +2

    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

  • @bharanidharans5857
    @bharanidharans5857 3 роки тому

    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

  • @timhaynes6735
    @timhaynes6735 Рік тому

    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.

    • @timhaynes6735
      @timhaynes6735 Рік тому

      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

  • @Brick-il8on
    @Brick-il8on 6 місяців тому

    There are no subtitles in this issue. If you can cherno, thank you for adding it.

  • @bulentgercek
    @bulentgercek 3 роки тому

    Great as always. Much love.

  • @Raspredval1337
    @Raspredval1337 4 роки тому

    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.

  • @hhehe24
    @hhehe24 Рік тому

    2:50 this is incredibly helpful as an aid for a uni course, for me at least; very helpful

  • @leocarvalho8051
    @leocarvalho8051 4 роки тому +1

    Hi Cherno. Kudos from cape verde. Please make a series on popular projects code walktrough

  • @xardinlume7345
    @xardinlume7345 3 роки тому +2

    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.

  • @amantiwari4736
    @amantiwari4736 4 роки тому +1

    please do a DS full series 😍😍

  • @nextwave5164
    @nextwave5164 4 роки тому +4

    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

  • @Yupppi
    @Yupppi 10 місяців тому

    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.

  • @alltheway99
    @alltheway99 4 роки тому +1

    Long time no see 😂
    You have a backlog of c++ topics you have to catch up man 🙂

  • @peternjorogej
    @peternjorogej 4 роки тому +1

    How about linked lists (std::list) next? I would really like to see how iterators would work with data structures such as lists😅...

  • @lerdi
    @lerdi 2 роки тому

    That keyboard typing is just soo satisfying

  • @kicchu15
    @kicchu15 4 роки тому

    Hello Cherno your videos are great. Also it would be great if you can possibly post some videos on Design patterns and Data Structures.

  • @Phroggster
    @Phroggster 4 роки тому +7

    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.

    • @SumoCumLoudly
      @SumoCumLoudly 4 роки тому +3

      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.

    • @AlFredo-sx2yy
      @AlFredo-sx2yy 2 роки тому

      @@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.

  • @MaxRaskin
    @MaxRaskin 3 роки тому

    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

  • @oscarahlke1585
    @oscarahlke1585 3 роки тому

    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!

    • @stepanhrbek8151
      @stepanhrbek8151 3 роки тому +1

      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!

  • @foodsweets2728
    @foodsweets2728 3 роки тому +4

    Playback Speed = 0.75, and you will understand every thing.

  • @mattiacolombo6246
    @mattiacolombo6246 2 роки тому +1

    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...

  • @peanutbutter8885
    @peanutbutter8885 Рік тому

    I love it, I just have to watch it at 0.75x, my brother, you are talking super fast.

  • @linternetsansfil4152
    @linternetsansfil4152 4 роки тому +4

    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 ?

  • @YRBYD
    @YRBYD 4 роки тому +1

    Great Video! Is your VS color scheme somewhere available for download? Really like it

  • @marilynwen7179
    @marilynwen7179 2 роки тому +1

    Does anyone know if he shares the code to the public and where that is? Thanks!!

  • @korara3508
    @korara3508 2 роки тому +1

    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!

  • @mallasarjsulebhanvi4128
    @mallasarjsulebhanvi4128 Рік тому

    Thanks Cherno, It was really a good learning experience

  • @prajyotgajane1528
    @prajyotgajane1528 4 роки тому

    Please make a video on allocator's !!!

  • @embeddedbastler6406
    @embeddedbastler6406 3 роки тому

    Coming from Rust, implementing Iterators is kind of the same thing, but in Rust it feels like a bit better integrated into the language.

  • @Byynx
    @Byynx 6 місяців тому +2

    Could someone explain me what the scope resolution operator :: is doing before the call of some operator() functions? Like ::operator new()

    • @gerfggrgr8975
      @gerfggrgr8975 4 дні тому

      Check out placement new and placement delete, it allows for separation of allocation and construction of an object

  • @Alexino-xi1mn
    @Alexino-xi1mn 4 роки тому

    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.

  • @Sami-df7dj
    @Sami-df7dj 4 роки тому +6

    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.

  • @RuthlessShinobi
    @RuthlessShinobi 4 роки тому +1

    the cherno

  • @ianpan0102
    @ianpan0102 4 роки тому +2

    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?

  • @coenfuse
    @coenfuse 3 роки тому +1

    Godbless UA-cam's playback speed option

  • @RuthlessShinobi
    @RuthlessShinobi 4 роки тому +1

    the cherno

  • @RuthlessShinobi
    @RuthlessShinobi 4 роки тому +1

    the cherno

  • @darshitnasit3130
    @darshitnasit3130 4 роки тому +3

    Can anyone explain why at 11:24 he has use
    using ValueType = typename Vector::ValueType ??
    Why we can't use
    using ValueType = Vector::ValueType

    • @damnstupidoldidiot8776
      @damnstupidoldidiot8776 4 роки тому +1

      I have no idea, but you kind of just do, the compiler will throw an error and tell you to put typename.

    • @mequint2000
      @mequint2000 4 роки тому +2

      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
      @Raspredval1337 4 роки тому

      @@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?

    • @mequint2000
      @mequint2000 4 роки тому

      @@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?

  • @skyeplus
    @skyeplus 3 роки тому +1

    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.

  • @nguyenacquan2977
    @nguyenacquan2977 2 роки тому

    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

  • @kamkamkil1
    @kamkamkil1 4 роки тому

    hi are you going to make video about the newer iterator introduced in cpp20 ? i mean with tags and everything

  • @eduardovaldez4013
    @eduardovaldez4013 2 роки тому

    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.

  • @cmdlp4178
    @cmdlp4178 4 роки тому

    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

  • @codingsaroj18
    @codingsaroj18 4 роки тому

    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?

  • @blank-vw2sb
    @blank-vw2sb 3 роки тому

    2:02
    "keyboard exercises"

  • @baardi2
    @baardi2 3 роки тому

    Whats up with indexing on the iterator? What's that useful for?

  • @paulzupan3732
    @paulzupan3732 Рік тому

    Is there any reason not to just use emplace_back all the time, since it’s more efficient?

    • @paulzupan3732
      @paulzupan3732 2 місяці тому

      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).

  • @AnalogDude_
    @AnalogDude_ 4 роки тому +1

    most compilers want: for(unsigned long i = 0; i < values.size(); i++)

    • @32gigs96
      @32gigs96 4 роки тому +1

      step aside noob. we gotta needlessly overcomplicate this for no reason. i want those compile times DOUBLED!

  • @AnalogDude_
    @AnalogDude_ 4 роки тому

    that is Microsoft standard library

  • @daniilmurray3751
    @daniilmurray3751 4 роки тому

    FINALLY.

  • @cicciobombo7496
    @cicciobombo7496 4 роки тому +1

    asking someone to read stl code is something i wouldn't wish to my worst enemy

  • @rodionsabbath9722
    @rodionsabbath9722 4 роки тому +1

    Hey Cherno! What's your C++ book recommendation?

  • @pavelperina7629
    @pavelperina7629 4 роки тому

    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

  • @rafalmichalski4893
    @rafalmichalski4893 4 роки тому

    Finally bug with missing placement new fixed (I pointed it under Vector video).

  • @tamelo
    @tamelo 3 роки тому

    WHere is the source code?
    It is impossible to follow going up and down the page.

  • @kunalmuley09
    @kunalmuley09 2 роки тому

    11:55 How m_data pointer of Vector class is stored in Vector Iterator class

  • @itihaasa9061
    @itihaasa9061 3 роки тому

    Can someone please share the link where implementation of vector or for that matter entire STL can be found.

  • @Adam_Lyskawa
    @Adam_Lyskawa Рік тому

    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?

  • @antonaparin
    @antonaparin 3 роки тому

    That's too hard to understand. Couldn't you do everything from scratch and not switch files so much?

  • @himanshugupta7313
    @himanshugupta7313 3 роки тому

    Does anybody has the source code for this? Reading the STL gives me a headache.

  • @杨基永
    @杨基永 5 місяців тому

    this video's not getting captions 😂,well i'll take it as an exercise

  • @gower1973
    @gower1973 4 роки тому

    The command and conquer code base was released open source, maybe you could do a video series on it, walking us through it.

  • @milos5247
    @milos5247 3 роки тому

    What is theme he is using for VS?

  • @omarshahin4881
    @omarshahin4881 4 роки тому

    Would you put source file here please or any link to the source file, please?

  • @AnalogDude_
    @AnalogDude_ 4 роки тому

    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.

  • @bartoss92
    @bartoss92 4 роки тому

    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

  • @SpicyCurrey
    @SpicyCurrey 4 роки тому

    Nice

  • @catinwall4256
    @catinwall4256 4 роки тому

    hi

  • @RuthlessShinobi
    @RuthlessShinobi 4 роки тому

    the chern

  • @RoshanPradhan2
    @RoshanPradhan2 4 роки тому +1

    Hey Cherno, can you recommend me a laptop under 100k rupees?

  • @wazydotmeter
    @wazydotmeter 4 роки тому

    I have never seen that episode up their, Have you

  • @aryanparekh9314
    @aryanparekh9314 4 роки тому

    Helpful? The standard way to learn C++ is to read textbooks and watch The Cherno videos

  • @gamingtech276
    @gamingtech276 4 роки тому

    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?

    • @ianpan0102
      @ianpan0102 4 роки тому +2

      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)

  • @dc7538
    @dc7538 4 роки тому +1

    Hi, is there any other way to open/find that vector class file, because I don't use visual studio, thanks in advance.

    • @Raspredval1337
      @Raspredval1337 4 роки тому

      your compiler typically has the std::lib headers in it's include directory somewhere in the compiler files, try searching there

  • @djllesh
    @djllesh 4 роки тому +1

    What theme is he using in Visual Studio? I want that so badly

    • @B1ankeys
      @B1ankeys 4 роки тому +1

      Hes using visual assist which is a paid add on for visual studio

    • @djllesh
      @djllesh 4 роки тому

      @@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

  • @meyvy3792
    @meyvy3792 4 роки тому

    great video,what the name of your theme thoXD

  • @irmadavitashvili9359
    @irmadavitashvili9359 2 роки тому

    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 :)

  • @airbus5717
    @airbus5717 Рік тому

    Ah yes, msvc is simple !!!!!!!!!!

  • @luandkg
    @luandkg 4 роки тому

    Great 😙😙😙😙😙

  • @conflikt89
    @conflikt89 4 роки тому

    jeez that intro really channeled peter mckinnon

  • @focus9099
    @focus9099 4 роки тому

    how long have you been doing this "hey what's up guys" with the hands? It's pretty cool :)

  • @ataulfogomezgarcia5433
    @ataulfogomezgarcia5433 4 роки тому +1

    Could someone please tell me which font and theme is he using?
    Thanks in advance.

  • @ronitech7802
    @ronitech7802 4 роки тому

    Does C++ have any inbuilt mechanism to add iterator support to user defined structures?

    • @Raspredval1337
      @Raspredval1337 4 роки тому

      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