POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Days 5- Server Time
29 Jul 2024 22:24:09 EDT (-0400)
  Re: Days 5-  
From: Darren New
Date: 19 Apr 2012 21:16:14
Message: <4f90b8de$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.