Function Templates | C++ Tutorial

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

КОМЕНТАРІ • 24

  • @t01
    @t01 2 роки тому +6

    Thank you. This gotta be the highest quality and most in-depth C/C++ content around!

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

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

    Thank you! You explained this concept way better than the learning materials provided by my school

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

    Thank you... very useful...🙏

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

      You're welcome, I'm happy that you found the video useful! :-)

  • @XharkXlayer
    @XharkXlayer 11 місяців тому

    God bless you for your programming tutorials! you have been a ton of help in my academic and professional career!

    • @PortfolioCourses
      @PortfolioCourses  11 місяців тому

      I'm so glad to hear that these tutorials have helped you out! :-D

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

    Such good explanations!

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

    This is a really good explanation thank you

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

    Thank you.
    Really good and helpful explaination.

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

    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  2 роки тому +2

      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 2 роки тому

      @@PortfolioCourses This is exactly what I was looking for - thank you!

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

      @@peterwan1808 You're welcome! 🙂

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

    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?

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

    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 роки тому +1

      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.

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

      @@PortfolioCourses fair enough. Thanks for taking your time to answer back!

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

    Thank u man .
    I am watching u from syria 🤍