In this vid we’ll explore function templates in C++. This is powerful mechanism which makes the compiler write multiple versions of a function for us depending …



  1. There are many cases where I'd want to compare the integer values of chars or any 1 byte data type. Correct me if I'm wrong but, chars and bools are the only 1-byte data types in the c++ standard. You can use __int8 in VS but that's Microsoft specific.

  2. I really love your style, you can perceive the preparation and work you put in your videos. Is there any chance you will make a new version of asm tutorials/serie? The old makes me cringe too much to follow it(audio/video/*shame*length)

  3. When handcrafting classes and using whole objects please pass them as by reference, these is no point of copying them anyway. Aside from that, very good tutorial!

  4. Why does the template exe size matter?

    Suppose I had to define an int Swap, a float and a double Swap, I'd have 3 Swaps which the compiler would have to compile.

    If I wrote a template, and used int, float and double, it would still have to compile 3 Swaps.

    But then, it'll only make new datatype compilations for every new datatype used, which the programmer would do if it were done the way of overloading functions.

    So why does the template generate a larger exe?

  5. Hey there, love the video (I'm learning C++ in college right now so it helps XD), sorry if this is a bit long but I want to be honest and keep this as straight to the point as possible. I stumbled on to your (underappreciated) channel and your content is great, like really great, lots of potential to grow. I have a YouTube network (The Kyo Network) and would love if you joined our team! The vast majority of networks are scams that take your money but don’t even help you, so I created mine to be different. I understand how hard it to succeed on YouTube, I’ve been there (I’m still there lol), that’s why I can truthfully say I made this network to help others succeed. I’m dead serious, my channel is my proof; three out of four of my shows are about helping other YouTubers. I think people see why we’re different, hence why after just a week we’ve already partnered over a hundred channels with thousands of subscribers. We think there’s lots of reasons you’d like it here:
    – Firstly, no lock in. Ever unhappy? You can leave any time you want (although we’d rather you stay lol)
    – Second, and most important, what separates us from nearly all other networks is we actually care about you (not your money), we offer top tier one on one support to help you run your channel better! Unlike others, we’ll actually admit you have to be what makes your channel grow, but that doesn’t mean we won’t do our best to help! Ask for strategies, help with doing something on Photoshop, even just an opinion, really just anything! Sky’s the limit! We’ll also feature you on our main channel (it has over 10,000 subscribers) and use multiple methods to try and boost your success. We offer access to Epidemic sound too (hundreds of thousands of songs, usually costs $160 a year, but free for us).
    – Finally, with us the average RPM (revenue per thousand views) is $4-5 instead of YouTube’s $1. Our CPM is high too, but that misleading number isn’t important to how much you’re making. Also we have no payment threshold (no waiting until you reach $100) and can get you paid company sponsorships.
    Really there’s tons of other reasons we think you’d like our team too, but I already wrote way too much lol so I wanted to stick to just three things, way more details are on our site anyway. If you don’t want to join us I understand, you totally should doubt the legitimacy of any network coming at you, but if you do give us the chance, I guarantee you won’t regret it (and even if you do you can leave at any time lol)! Anyway, if you’re interested I can give you the link to our site. If not, just promise me you’ll keep making awesome videos! Have a nice day!

  6. dude templates a so awful, awful to debug, slows compiler… C++ template syntax is horrible, with all sorts of notorious problems with angle brackets and typename and other issues..Modern languages are so poorly designed that they hinder you more than they help when you are trying to actually program at a high level if you care about what the results are at the low level, which I do.

  7. Unfortunately there are many different cases in templates, where type deduction is different, and the behaviour is often not what you'd expect. Scott Meyers has a great talk on this, called "Type deduction and why you care", and I really think it's worth knowing about that when using templates.

Leave A Reply

Please enter your comment!
Please enter your name here