@raker@lemmy.world to Programmer Humor@lemmy.mlEnglish • 2 years agoOmnilingualismlemmy.worldimagemessage-square40fedilinkarrow-up1838arrow-down119
arrow-up1819arrow-down1imageOmnilingualismlemmy.world@raker@lemmy.world to Programmer Humor@lemmy.mlEnglish • 2 years agomessage-square40fedilink
minus-square@Valmond@lemmy.worldlinkfedilinkEnglish6•2 years agoHow so, templates make for less code usually? Or like template meta prog? I’m a C++ dev and I’m lost on this one :-p plz send help
minus-squarePhrodo_00linkfedilink3•2 years agoI think it’s because each template specialization works kind of like a new copy of a class.
minus-square@Valmond@lemmy.worldlinkfedilink1•2 years agoStill not getting it, I mean you don’t even get to see the code? IDK
minus-square@JakenVeina@lemm.eelinkfedilinkEnglish1•2 years ago/shrug That’s my best guess, in the sense that that’s what the compiler ends up producing, for templated code: the same code copy-pasted for however many different use cases you have.
How so, templates make for less code usually? Or like template meta prog?
I’m a C++ dev and I’m lost on this one :-p plz send help
I think it’s because each template specialization works kind of like a new copy of a class.
Still not getting it, I mean you don’t even get to see the code? IDK
/shrug
That’s my best guess, in the sense that that’s what the compiler ends up producing, for templated code: the same code copy-pasted for however many different use cases you have.