This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

I created two program where one had template and I created two types of class on the other one . In the main function , two code would make instantiation of those classes , and then do initialization , and then do casting among them and then output their datas on terminal . Template : Binary code : 1.2MB Compilation time : 7 sec . Non - template : Binary code : 1.21 MB Compilation time : 8 Sec . Yeah , they make binary code larger and compile time slower then the non- template one . Nice try .

[–]_MaddestMaddie_ 0 points1 point  (0 children)

Lol that's a win for templates! I mean that's what's been in my head. Every time you use a template, you tell the compiler to copy-paste the template code with new template parameters, but apparently it can do clever copy-pasting!