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
@t012 жыл бұрын
Thank you. This gotta be the highest quality and most in-depth C/C++ content around!
@PortfolioCourses2 жыл бұрын
Thank you very much! :-D
@Victor-fl8ex2 жыл бұрын
agree
@valentinsimeonov1296 Жыл бұрын
Thank you! You explained this concept way better than the learning materials provided by my school
@PortfolioCourses Жыл бұрын
You’re welcome Valentin! :-)
@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.
@XharkXlayer5 ай бұрын
God bless you for your programming tutorials! you have been a ton of help in my academic and professional career!
@PortfolioCourses5 ай бұрын
I'm so glad to hear that these tutorials have helped you out! :-D
@ecmrn6 ай бұрын
Such good explanations!
@death2theworld Жыл бұрын
This is a really good explanation thank you
@PortfolioCourses Жыл бұрын
You’re welcome Arina! :-)
@-alaa5292 Жыл бұрын
Thank you. Really good and helpful explaination.
@PortfolioCourses Жыл бұрын
You're welcome, I'm glad you enjoyed it! :-)
@johnibat Жыл бұрын
Thank you... very useful...🙏
@PortfolioCourses Жыл бұрын
You're welcome, I'm happy that you found the video useful! :-)
@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 Жыл бұрын
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 Жыл бұрын
@@PortfolioCourses This is exactly what I was looking for - thank you!
@PortfolioCourses Жыл бұрын
@@peterwan1808 You're welcome! 🙂
@mikexue510410 ай бұрын
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-fl8ex2 жыл бұрын
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?
@PortfolioCourses2 жыл бұрын
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-fl8ex2 жыл бұрын
@@PortfolioCourses fair enough. Thanks for taking your time to answer back!