Is there any difference of speed when we define an object of a template class by mentioning data type and the same by not ....? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Is there any difference of speed when we define an object of a template class by mentioning data type and the same by not ....?

25th May 2019, 6:17 AM
//(AnOnYmOuS);
2 Answers
+ 4
Generally you use templates to do the work you can do at compile time, so compile time increase. You may do this to optimize your code so it should run faster at runtime. This is just a general sense though it depends on what you exactly want to do.
25th May 2019, 4:42 PM
AZTECCO
AZTECCO - avatar
0
they don't affect the run time since the objects are creating at the time of compile: https://stackoverflow.com/questions/2442358/do-c-templates-make-programs-slow
25th May 2019, 6:26 AM
Farry
Farry - avatar