C++ Basic Skills: Lesson 27 "Templates"

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
9,924
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Sep 4, 2009

We look at using templates with functions and classes so we can work with different types of data without having to write everything out more than once.

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (outofmylaboratory)

  • So what's the difference in using "const T&" vs simply "T&" from the performance standpoint?

  • @phirseatthi There is no performance difference but if you make something const then you won't accidentally modify it. This is particularly important when working with references since you don't know where the data might be coming from so it's a good idea to generally use constant references except in the case of our swap function or something similar.

Top Comments

  • Genius!

  • Thanks a million !!!!!!!!

see all

All Comments (59)

Sign In or Sign Up now to post a comment!
  • Also, thumbs up bro. Thanks!

  • The class example was lame. But you described it better than my teacher could!

  • THanks for making this video, 

  • @twentyFifthOfFeb if you pass by value a copy is made(which calls the copy constructor) and in most cases when you pass an object into a function you want that object itself(or a reference to it)

    even if it were a const function, you usually don't want copies being made

  • thankss sir ........

  • Great, thnx!

  • Great vid. My C++ teacher never got to this so I was confused once I got into data structures.

  • That was a cliffhanger there at 9:30

  • thnx...

  • Thank u ...nice and clean ....:)

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more