This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ automatic template instantiation?


> Isn't that going to make your code n times larger because it will
> instantiate all the templates in all the object files?

It instantiates only those that are needed, not all of those that an
explicit instantiation would instantiate.

Also, if you have a smart linker (such as GNU ld), the linker will
remove the duplicates when linking, so only one copy makes it into the
executable.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]