[C++-sig] function template instantiation

Kyle Cronan kyle.cronan at geostellar.com
Fri Mar 30 00:38:03 CEST 2012


On Thu, Mar 29, 2012 at 4:42 PM, Stefan Seefeld <stefan at seefeld.name> wrote:
>
> It certainly is enough to require, but isn't enough to magically make a
> definition to appear. Either you provide the definition in the header,
> and let the compiler do that magic of instantiating the template
> on-demand, or you defer to a separate compilation unit, but then can't
> rely on such magic and need to explicitly instantiate.

Makes sense, thank you.  Hopefully, having this in the list archive
will help others in the future.  Somehow I had never run into the need
to use explicit instantiation before!  But I think I get it now: by
the time the linker sees what's going on it's too late to generate the
necessary object code.

Best,
Kyle


More information about the Cplusplus-sig mailing list