|
|
On 4/17/2012 8:06, Warp wrote:
> Invisible<voi### [at] devnull> wrote:
>>> Likewise template functions are implicitly 'inline' without having to
>>> explicitly say so.
>
>> Well, by definition a template generates a new copy of the function each
>> time you use it, no?
>
> No. A new version is created for each used *type*.
Technically, I think a new copy of the function is generated/compiled for
each compilation unit that uses it for each type, but the different versions
for the same type are merged, right?
I.e., if x.c uses myfunc<int>() and y.c uses myfunc<int>() you'd need to
compile that function twice and toss one at link time, right?
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
|