Function Templates | C++ Tutorial

  Рет қаралды 6,503

Portfolio Courses

Portfolio Courses

2 жыл бұрын

How to use function templates in C++ to reduce code duplication. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Пікірлер: 23
@t01
@t01 2 жыл бұрын
Thank you. This gotta be the highest quality and most in-depth C/C++ content around!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you very much! :-D
@Victor-fl8ex
@Victor-fl8ex 2 жыл бұрын
agree
@valentinsimeonov1296
@valentinsimeonov1296 Жыл бұрын
Thank you! You explained this concept way better than the learning materials provided by my school
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You’re welcome Valentin! :-)
@stepsvideos
@stepsvideos Жыл бұрын
I learn something new, about C++, every few years. Maybe it's because it's only every few years that someone comes along, and shows you that the C++ feature that you may have heard about and shied away from, is not a Pandora's box full of icky things, but something simple and very useful. Many thanks.
@XharkXlayer
@XharkXlayer 5 ай бұрын
God bless you for your programming tutorials! you have been a ton of help in my academic and professional career!
@PortfolioCourses
@PortfolioCourses 5 ай бұрын
I'm so glad to hear that these tutorials have helped you out! :-D
@ecmrn
@ecmrn 6 ай бұрын
Such good explanations!
@death2theworld
@death2theworld Жыл бұрын
This is a really good explanation thank you
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You’re welcome Arina! :-)
@-alaa5292
@-alaa5292 Жыл бұрын
Thank you. Really good and helpful explaination.
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome, I'm glad you enjoyed it! :-)
@johnibat
@johnibat Жыл бұрын
Thank you... very useful...🙏
@PortfolioCourses
@PortfolioCourses Жыл бұрын
You're welcome, I'm happy that you found the video useful! :-)
@peterwan1808
@peterwan1808 Жыл бұрын
Thank you for posting! If possible, could you provide an explanation as to why a function template definition should be put inside a header file (as opposed to keeping the implementation of the function template in a .cpp file and the prototype of the template in a .h file like normal functions) ?
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Placing the function template definition in the header file allows it to be defined before it is used anywhere, from the perspective of the compiler that is reading your program source code, which can allow the compiler to better optimize the code. This link describes the issue: www.bogotobogo.com/cplusplus/template_declaration_definition_header_implementation_file.php. 🙂
@peterwan1808
@peterwan1808 Жыл бұрын
@@PortfolioCourses This is exactly what I was looking for - thank you!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
@@peterwan1808 You're welcome! 🙂
@mikexue5104
@mikexue5104 10 ай бұрын
what if all parameters and return value with different type? say, divide(double a, int b) {return "result is " + a/b; }. how to define the template function?
@Victor-fl8ex
@Victor-fl8ex 2 жыл бұрын
Hey Kevin. I hope you doing well ! Nice video once again. I would like to contact you somehow to ask something about some code of mine. Its pretty light, is there any chance I can reach you?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Right now between my day job, making videos for this channel, and my family, I won't be able to get into helping people over e-mail or something like that. In the future I am hoping to setup some kind of 1-on-1 tutoring option, but for right now I can't yet.
@Victor-fl8ex
@Victor-fl8ex 2 жыл бұрын
@@PortfolioCourses fair enough. Thanks for taking your time to answer back!
Class Templates | C++ Tutorial
12:48
Portfolio Courses
Рет қаралды 45 М.
Overloading Function Templates | C++ Tutorial
9:54
Portfolio Courses
Рет қаралды 7 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 17 МЛН
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 23 МЛН
How to use FUNCTION TEMPLATES - a comprehensive guide for modern C++
23:33
Code for yourself
Рет қаралды 2,1 М.
new & delete Operators For Dynamic Memory Allocation | C++ Tutorial
15:52
Portfolio Courses
Рет қаралды 27 М.
TEMPLATES in Modern C++
9:31
cazz
Рет қаралды 27 М.
Dynamic Binding (Polymorphism) With The Virtual Keyword | C++ Tutorial
9:57
What is Mutex in C++ (Multithreading for Beginners)
12:29
CodeBeauty
Рет қаралды 41 М.
Arrays in C++
18:31
The Cherno
Рет қаралды 419 М.
C++ Pass by Value, Reference, Pointer Explained
10:18
Caleb Curry
Рет қаралды 40 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН