auto instantiation?

Ian Lance Taylor iant@google.com
Wed Jun 10 15:36:00 GMT 2009


daviddoria <daviddoria@gmail.com> writes:

> When using some big libraries, they will have a folder full of
> "instantiation" files which declare templates with commonly used types. I
> read somewhere that you can turn on "auto instantiation" with some compilers
> which will allow you to use any type you'd like in a templated class in a
> library without having to create an instantiation file. Can you do this with
> g++?

g++ does this automatically, provided that all the required template
definitions can be seen at the point of template instantiation.  If they
are not available--if parts of the templates not defined in header
files--then you need to use explicit instantiation, or you could try
using -frepo.

Ian



More information about the Gcc-help mailing list