Templates in C++

Поділитися
Вставка
  • Опубліковано 12 січ 2025

КОМЕНТАРІ • 600

  • @AhmedTahagg
    @AhmedTahagg 5 років тому +1749

    "By no means is this going to be the only video I make on templates"
    - The Cherno 2017

  • @sigmareaver680
    @sigmareaver680 2 роки тому +376

    For all the novices out there, I think there's one important thing he overlooked regarding using templates. With templates, you must either write AND use them inside a SINGLE source (cpp) file, OR you must write them ENTIRELY inside a header file. Unlike a regular function or class, you can NOT declare them inside a header file and then define them inside a source file. The linker won't be able to link the templates if you do.

    • @Austin_Rummel
      @Austin_Rummel Рік тому +5

      Thank you! I was just about to do that.

    • @rretro2042
      @rretro2042 Рік тому +10

      Also you could write the declarations inside a .h header file and the definitions inside .tpp file

    • @manipurihunabopa
      @manipurihunabopa Рік тому +6

      This video reduces the ambiguity about templates in C++ which was increased by other video tutorials. Thanks bro.

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

      Can you separate the declaration and implementation in hpp and cpp files, and then include the cpp file at the end of the hpp file? Its technically the same thing but more organized i guess.

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

      Ok

  • @baaryl
    @baaryl 7 років тому +1004

    I love this series. Motivated me to learn c++ and just got my first job as a software engineer. Keep it up!!!

    • @PflanzenChirurg
      @PflanzenChirurg 7 років тому +56

      love to read that :)

    • @radoznalipustolov2693
      @radoznalipustolov2693 6 років тому +10

      Congratulations! If it's not the secret, what kind of software development you do?

    • @padelafterdark
      @padelafterdark 6 років тому +13

      what resources did you use to learn C++ and what techniques did you do to learn it? Thanks

    • @baaryl
      @baaryl 6 років тому +11

      Nikola013
      First of all I have no idea how to reply directly to your comment - so sorry for that. Anyway, this in not a secret :D I work in telecommunication

    • @baaryl
      @baaryl 6 років тому +26

      Mark Tilbrook
      Just like befor dont know how to reply to your comment directly. Nothing special at all. Two books (one of authors was Stephen Prata, "professional c++" Solter and Kleper ), some videos like this and compiler and build some simple app (e.g calculator). Next step was to take part in c/c++ academy (it's kind of course) organised by the company in which I work now :)

  • @bgzdevtips3762
    @bgzdevtips3762 7 років тому +158

    Another reason you shouldn't want to go too crazy with templates is compilation times. As cherno said, you're basically having the compiler write code for you. If you start having your compiler write a ton of code for you, then be prepared to wait a bit longer for your program to compile.

    • @ags0004
      @ags0004 6 років тому +12

      Yeah, and worse than that is that headers cannot even be cached for multiple translation units. For each translation unit, you have to generate each header, even if that header was already generated before. This is one of the greatest problems an inefficiencies with the whole header system. I also feel like precompiled headers are sort of a hack rather than a solution to the problem...

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

      @@ags0004 I wonder how will C++20 modules turn out

  • @HanhTangE
    @HanhTangE 4 роки тому +340

    I know he’s an expert in C++ because he can talk about single concept for ~20 min, where every second counts 👍

    • @mantaz3068
      @mantaz3068 4 роки тому +26

      I think I never watched a 20 min video about a single concept without skipping any part before this

    • @typeterson8376
      @typeterson8376 3 роки тому +6

      I judge how good of a teacher a UA-camr is by whether or not I need to put their videos on 1.25x speed, because some are just too slow of speakers of too verbose. His flow of information seems to be just right.

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

      you know when you are a noob when you need every second to understand a concept.

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

      @@dennisorbison7318 If you want to learn something, you have to start with the basics. Otherwise, you will have memorized, which will cause the knowledge to be erased from your mind over time. So learning something that works for you always requires starting from the basics. The person who learns should not have an ego anyway. The word noob is an expression of the self-conceit of the person who uses it. Because no matter how much you learn, there is always something to learn in the details, even in a subject you know very well. Learning has no end. Also, no matter what your mastery level is, you're always going to solidify yourself by repeating the basics. In short, you are always a student. In other words, saying Noob to someone else is a sign of smugness also It is a sign of a lack of self-confidence.

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

      @Bulent Gercek I think I am missing context or something, or somebody is missing context, because I am so confused, lol. Did I call somebody a noob? I am pretty sure I was using the word "you" in the general sense, not at anyone specifically. I commented haphazardly as to something I can personally relate with. Bruh, what is up with the assumptions? It's all right though. I forgive you for looking too deep into something and drawing out conclusions with very little context.

  • @VadimMelnicuk
    @VadimMelnicuk 6 років тому +237

    Simply, the best C++ lessons in existence.

  • @Kromush1995
    @Kromush1995 6 років тому +105

    Dude, your videos are incredibly well explained, never seen that in any other channel. As a junior C/C++ developer myself, I learn a lot of new things from you. Keep up the C++ series going!! Great job!

    • @philippbecker3117
      @philippbecker3117 5 років тому +3

      How can you get a job not knowing templates???

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

      @@philippbecker3117 As a C programmer? I learnt basic c++ in electronics at university, but got a job as a hardware engineer dabbling in firmware. Now I've moved to straight firmware, and c++ is starting to be useful for me right now, so these videos are great.

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

      @@ThisRandomUsername Man if you fuck up the firmware of some coffee machine I buy I'll be pissed. The coffee machine of us gets sometimes stuck in a state smh. And the code I see in some Arduino tutorials just shows that they never learned the language before they started to hack away on their garbage code. But I'm glad you are learning.

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

      @@philippbecker3117 Lol. I'll do my best mate.

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

      @@philippbecker3117 maybe it was the machine I made

  • @GFXNever
    @GFXNever 7 років тому +61

    As a matter of fact, the templates system is turing complete - that means you can actually implement ANY computer program using templates (and that program will run at compile time).
    Great video !

    • @stewartzayat7526
      @stewartzayat7526 7 років тому +5

      GFXNever What do you mean by 'using templates'? It's turing complete even without them, so that doesn't make sense to me.

    • @jakobhellermann6974
      @jakobhellermann6974 6 років тому +18

      GFXNever as a matter of fact, the x86 mov instruction is Turing complete ;)

    • @MsJavaWolf
      @MsJavaWolf 5 років тому +15

      @@stewartzayat7526 C++ is of course Turing complete at RUNTIME, but with template metaprogramming you can compute anything that you want at COMPILE time.
      An example that is not template meta programming: constexpr int a = 7 + 8; the compiler will not generate code that moves 7 and 8 to registers and adds them, it will simply add it at compile time and the code will be a = 15; so no calculation has to run at runtime.
      Template metaprogramming is similar to that, but much more powerful.

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

      Oh yeah, i read an article about this and how the template system it's theoretically undecidable, but there were problems with the proving method, i didn't pay much attention to it so i'm not sure

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

      @@stewartzayat7526 I've seen somewhere how people created a power function (a^b) that evaluated powers at compile time.

  • @leixun
    @leixun 4 роки тому +21

    *My takeaways:*
    1. Problem with function overloading 2:02
    2. Function template 4:01
    3. Class template (variable) 10:06
    4. Class template (data type and variable) 12:16
    5. Where we may use template 16:10

  • @user-sd2en6pn3z
    @user-sd2en6pn3z 5 років тому +2

    Why is it that nobody else seems to be able to explain c++ templates so clearly? I probably spent half a day struggling with this, then came upon this video and it was immediately clear. And even if I knew nothing about templates before seeing this, I think I still would have understood just as clearly. Thanks!

  • @DanielLiljeberg
    @DanielLiljeberg 6 років тому +36

    The thing I loved back when I started with C++ and learnt about templates (although the syntax can understandably look like drunk talk to people) was the fact that this is NOT some dynamic thing based on some shared base object the entire language uses but still enables you to create equally or more flexible code. By having the compiler generate the needed code for each type you use your templates with you basically add no extra runtime cost. That was awesome to young me.
    Another great side effect of how templates work and the fact that the template doesn't actually "exist as code" is that you can have a huge library of templates and it would not actually grow your binary a crazy amount unless you use them all. If it instead was a hughe library of "actual code" your binary would contain them all even if you only used a few of them.

    • @HermanWillems
      @HermanWillems 6 років тому +6

      Fuck yeah C++ is amazing. I makes you feel in control. Understand what happens underneath. You need to know the tradeoffs of certain choices. It has a higher learning curve. But when you manage to learn it... and understand the tradeoffs of things inside the language. It feels like you can do anything. :) Unlike Managed languages or scripts it feels like there is hell of alot unknown black magic going underneath. And that just feels weird. I personally don't like that.

    • @PumpReactivationProject
      @PumpReactivationProject 5 років тому +4

      @@HermanWillems C++ is amazing indeed. I was doing some lwjgl in java and it was all cool, I thought "Java is so amazing" and then I've stumbled upon decoding images and working with file formats. Oh... I cant use unsigned type... Oh... I can't treat array of bytes as array of ints, I need to iterate through and do a lot of bit shifting. C++ is hard - memory management, mix of different programming paradigms, namespaces, memory allocation, but at the end of the day it gives you power to control your program. Can't imagine going back to java now.

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

    C++23 made it easier. You can type:
    void Func(auto var) {
    std::cout

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

    What a much better introduction to templates than just explaining how vector foo or something.

  • @someone1089
    @someone1089 5 років тому +130

    Template = compile time polymorphism
    I don't like overuse of template, debugging is a nightmare. I have seen this horror myself.

  • @raf.nogueira
    @raf.nogueira 7 років тому +45

    I was trying to understand this Templates for such long time, and only now i understand thank you very much !

  • @ShivamSingh-ue2qi
    @ShivamSingh-ue2qi 7 років тому +29

    Really appreciate your series.. The way you explain things is so simple and effective

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

    These videos are amazing. I spent a whole day trying to figure out how to create an array of an unknown size in a class, only to give up and move on. I see now how it can be possible. So very well explained. This series is getting me though my college courses. Thank you for sharing your knowledge.

  • @janingvar
    @janingvar 3 роки тому +9

    You explain things better than some highly rated C++ lecturers on Udemy.

  • @LeandroNunesLeandroN
    @LeandroNunesLeandroN 4 роки тому +9

    "This can get really crazy, really quickly" is my favourite quote here.

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

    your delivery is really superb sir. Didn't see anyone like you.

  • @MoTharwat-sw2dc
    @MoTharwat-sw2dc Рік тому +2

    Clear, concise and straight to the point.

  • @koobyroory
    @koobyroory 6 років тому +4

    I love your series! I was having trouble in my C++ class and my TA suggested I should watch your videos. It has helped immensely

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

    Easily the best C++ resource on UA-cam, thanks man!

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

    Thanks!

  • @mistersir3185
    @mistersir3185 2 роки тому +7

    Cherno is an industry man that can also teach better than most college professors.

  • @MrMunoz-xp2ry
    @MrMunoz-xp2ry 3 роки тому +2

    Sometimes when i watch these videos, I replay that mind blown video in my head.

  • @vladlazar94
    @vladlazar94 7 років тому +19

    Great work as always! Your vids are on a totally different level! :D

  • @namahshrestha3226
    @namahshrestha3226 6 років тому +4

    You sir are amazing..we need more from you. Please do not stop making videos

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

    Why is he able to explain things in such a clear and simple manner so that everyone gets it and there are loads of books out there who can't?!

  • @Light-wz6tq
    @Light-wz6tq 7 років тому +9

    Best video about templates (Your series are awesome)

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

    best explanation of templates I have ever seen. thanks cherno!

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

    Your videos on c++ are AMAZING! Everything that my professor confused me on was ironed out in these 10-20 min videos. Thank you so much🥹

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

    This is the first video i've seen from this channel and i can't stop smiling at how easy he has explained templates! i'm so excited i finally get it! well done mate. great video. subbed

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

    Wow, I think this was the cleanest sum of templates I have ever seen. Thanks a lot!

  • @MadAustinite
    @MadAustinite 5 років тому +1

    I just learned more in 18 minutes than reading the same thing over and over again in my textbook for over an hour. Thanks man!

  • @noctua7771
    @noctua7771 6 років тому +5

    You make learning C++ so easy and entertaining
    Keep it up!

  • @ToxicityGameDev
    @ToxicityGameDev 7 років тому +293

    Dude, please don't let this C++ series go for OpenGL, Hope to see them both continue. Keep up the great work!

  • @riscy00
    @riscy00 7 місяців тому

    You did a fantastic job explaining things as I'm currently studying C++20 and later C++23 with ESP32 (even though the library is C). My experienced friend with C++ experience elsewhere suggests that I should try a template for class objects, which is why I'm watching this.

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

    Best C++ series I could find on the internet

  • @Orangeisthebes
    @Orangeisthebes 5 років тому +1

    This is a magical! the ease you explained one of most confusing and complicated topic is brilliant. pls keep going

  • @ericdecolsales3066
    @ericdecolsales3066 6 років тому +1

    Fantastic class. The basics of templates got so easy now.

  • @sinned_rev
    @sinned_rev 5 років тому

    Nice to see that you got straight to the point, where I was able to understand templates after having 90 minutes of programming lecture in the university without understanding a single thing :D

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

    i am sitting at work doing code reviews and watching your videos lmao you are a lifesaver

  • @TheIllerX
    @TheIllerX 6 років тому +1

    One of the best C++ series I have found on UA-cam. One can really feel that Cherno knows his stuff and gives really solid advice.
    Also love that he speaks relatively fast. Tend to loose attention if someone talks too slow.

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

    I love these video like documentations of individuals aspects of C++. Please keep making these, I love them.

  • @sandrokan89
    @sandrokan89 6 років тому

    Very useful infos, expecialy the "ignored typo in un-compiled function" exaple was eye-opening.
    By the way I don't know if you have any power over it, but you should consider "moving" the spot-break at 6:40 few seconds earlier or later as it interrupts a vital sentence mid-way and makes understanding a little bit more hard.

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

    THIS IS THE BEST VIDEO TO EXPLAIN TEMPLATES. You just earned a subsciber.

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

    13:18 was enlightening. "[...] a sort of meta-programming in C++ [...] instead of programming what our code does at runtime, we're kind of programming what our compiler will do at compile-time."

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

    Really loved this video...even stackoverflow kneeled down before you... thanks again.

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

    Thank you very much for the tutorials, they are helping me immensely with my Electrical Engineering Studies. This is the 2nd semester I have sourced your tutorials during cram sessions and they have helped. :-D

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

    best source of learning cpp ever. thanks man!

  • @guozhengdai2247
    @guozhengdai2247 7 років тому +3

    Thanks for this series. I have learned a lot from you!

  • @Richard-xh5iw
    @Richard-xh5iw 4 роки тому

    First of all, sorry for my English. I am from Argentina, I want to tell you that you are amazing explaining and a good person. Thanks for the explanation. From Argentina I embrace giants

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

    Dude making a template for an array makes c++ the most powerful programming language, I used to hate c++, but now, wow :)

  • @rajatpai5048
    @rajatpai5048 6 років тому

    The content of this series very apt and rich. I am recommending this to my friends. Thank you for doing this.

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

    this is probably the best tutorial i have watched, very intuitive.
    Awsome work brother.

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

    I wouldn't have started learning C++ if it was not for your videos. I watched starting 18-20 vids then shifted to books because I really needed to clear few concepts. Now I understand a little bit better than past and m back !!

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

    the way that u explain it bro just u r the G.O.A.T. in this game!

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

    Your videos are the best. Never stop making 'em.

  • @orocimarosay1447
    @orocimarosay1447 7 років тому

    best tutorials ever please make more since I can't find anywhere else such detailed and advanced information and this information is what can make me a good programer

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

    14:00 There are industry standards that strictly forbid usage of some language feature, and there are good reasons for that. In automotive software or some safety critical systems, for example, many very useful features of C++ and even C are forbidden.

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

      Okay, and what is the good reason not to use the useful features? Do you want to tell us?

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

      @@touchdepp4507 In embedded systems endianess might be an issue, especially for code portability, thus in automotive SW - unions are forbidden.

    • @raducrv1
      @raducrv1 4 місяці тому

      @@touchdepp4507another forbidden thing in safety critical systems is dinamic allocation of memory

  • @creativeclaude5304
    @creativeclaude5304 6 років тому

    woow amazing! I love how you actually put it into code and shoe us how its actually running. My instructor would only show it on whiteboard and I could not understand it but, seeing it in code helps so much!

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

    I love the fact that the first time that he said the template definition i didn't understand, but then he wrote the code and when he repeated the definition i did understand what it meant. Thanks for the videos

  • @VarunArora14
    @VarunArora14 5 років тому +1

    Best video to easily understand templates . I tried GeeksforGeeks but this made me understand better at beginner level .

  • @runetimon
    @runetimon 7 років тому +5

    Dude this video is perfect for some one not understanding templates! :D

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

    class -> template. u just change my world.

  • @voodoomotion5855
    @voodoomotion5855 5 років тому +1

    Excellent, I think this will help me a lot in what i'm currently developing! Thanks so much for your great tuition :)

  • @jackthehammer2245
    @jackthehammer2245 7 років тому

    Thanks for the intro for templates. Especially what really happened under the hood. Looking forward to see more of these coming!

  • @michaeldennison459
    @michaeldennison459 7 років тому

    Wow. Make a Data Structures & Algorithms series. You give so much information, it's great. So many books are vague on what's going on and are more or less "here's what this does, and here's the syntax" but they don't give you the HOW like you do. This is my first time watching one of your videos, and I'll definitely be back.

    • @alexandergonzalez5975
      @alexandergonzalez5975 6 років тому

      Michael Dennison
      Can you recommend any channels for DS’s and Algorithms? I need help.

  • @naeroforceofficial
    @naeroforceofficial 5 років тому +3

    Templates are a huge topic.
    Meanwhile in my classroom our professor wrote 5 pages of code and random theory+comment and expect us to understand the whole topic and be good at it.

  • @haroldcarter8366
    @haroldcarter8366 6 років тому

    understood in about 3 minutes, compared to my lecturer who literally just went off talking about the STL without explaining what a template is, he then expected you to know how to code a template from him briefly talking about the STL.

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

    9:40 Template specify how to create methods. Methods can be created by the compiler based on the usage of it.

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

    7:51 Let's say I'm making a library and I miss this syntactical error. This function is only for end-users so I never encountered the error while building my own library. When I finally publish it, and somebody uses it - only then will this error be caught. Then the user has to work around it somehow or wait until I fix my stupid mistake. This sounds horrible.
    Then again, sounds like this might not even be possible since it's basically just a macro, and the function wouldn't "materialize" if I don't use it within my own code.

  • @darshandhande8903
    @darshandhande8903 5 років тому

    This is one of the best videos of this series!

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

    This class stuff got me low key excited

  • @rose_no
    @rose_no 5 років тому +1

    Whaaaaaaaat?!?! This is crazy!! There's no way C++ gives programmers this much power!!

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

    Love ya 😍😍😍 and of course your series. Every sec worth a treasure!!!

  • @AhmadKhan-hb3je
    @AhmadKhan-hb3je 5 років тому

    This video is great. If I don't understand any topic in my class, I know The Cherno will help me and it always does. 😍👨🏻‍💻
    Thank you and love from Pakistan 🇵🇰

  • @SuperTravianPlayer
    @SuperTravianPlayer 5 років тому +1

    Awsome video! I love the chill vibe and your voice is great... =)

  • @respawn_101slab2
    @respawn_101slab2 5 років тому +1

    Amazing videos, just started watching the channel. I plan to watch every posted video. Keep it up!

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

    My man cherno helped me once again

  • @tomhollins9266
    @tomhollins9266 5 років тому

    A VERY clear explanation of templates. I will point newbies to your channel.

  • @TM-su7vu
    @TM-su7vu 3 роки тому +1

    Very simple and clear. I'm glad that I found your channel. Thanks!

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

    basically every c++ feature: just don't over use it

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

    Finally, I got how this weird C++ code in unreal engine works thanks man you made my day!!

  • @matiassandacz9145
    @matiassandacz9145 5 років тому +1

    IMPRESSIVE explanation. Very very VERY clear. Thank you.

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

    I once had a static method for splitting a string with a given delimeter.
    I wanted to reuse it, but in 1 spot I needed it as a std::set (wanted lexical sorting), in the other as a std::vector (wanted sorting like it was in the original string).
    I didn't want to copy paste the implementation of splitting ther string so maintaining is easier in case of bugs, so used a template and the .insert() function (with iterators) for supporting both std::vectors and std::sets.

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

    Going through the Firefox code. Endless templates, 20,000+ in 2083 files. Good refresher, thanks a bunch.

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

    WOW I just understood a load of stuff I didn't before... Thx Cherno. Best tutorials ever...

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

    You know!
    He is not teaching us!😂
    He showing us how to play with C++
    Just loved this video💝💝💝❤️🔥👍

  • @83vbond
    @83vbond 3 роки тому

    Love this man's sofa

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

    This is the best C++ series I've seen so far.

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

    When Cherno codes, I like .... when Cherno speaks, I love

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

    For some reason, the code in 8:00 doesn't compile for me. I copy pasted the code and it says: "error: 'valu' not found", although I don't use the template function.
    So I get compiler error without using the template as opposed to what he explains here.
    Has anything changed in c++ since 2017 that I am unaware of?

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

    What is the life cycle of the template function?
    On the video, Cherno said it gets created when it is called. But, when does it get destoryed?
    for example calling print function:
    print(5);
    Print("hello");
    print(5.5f);
    print(2);
    does the first print stay after first print() gets called? there is another print call later in the code.

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

    Wow. C++ is so powerful. Lots of possibilities!

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

    I did love for you to make a video about "Why companies hate C++ Template" from memory usage and programmer perspective.
    That will clear up something.

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

    At 8:00, when I tried to compile with the exact same code, it threw the "use of undeclared identifier" error. I'm assuming this is because I'm on OSX and my g++ is not actually g++ under the hood.

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

    C++ templates are an extremely versatile and powerful way for the skilled programmer to create the most complex and unreadable compiler error messages in all of computer science.

  • @doingsneakypeakylike
    @doingsneakypeakylike 7 років тому

    you make it so easy to understand! Please continue with more c++ vids. thank you :)