C++ Basic Skills: Lesson 27 "Templates"
Loading...
9,924
Loading...
Uploader Comments (outofmylaboratory)
Top Comments
-
Genius!
-
Thanks a million !!!!!!!!
see all
All Comments (59)
-
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...
So what's the difference in using "const T&" vs simply "T&" from the performance standpoint?
phirseatthi 10 months ago
@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.
outofmylaboratory 10 months ago