-qtemplateregistry (C++ only)

Category

Template control

Pragma equivalent

None.

Purpose

Maintains records of all templates as they are encountered in the source and ensures that only one instantiation of each template is made.

The first time that the compiler encounters a reference to a template instantiation, that instantiation is generated and the related object code is placed in the current object file. Any further references to identical instantiations of the same template in different compilation units are recorded but the redundant instantiations are not generated. No special file organization is required to use the -qtemplateregistry option.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-notemplateregistry-----------------.   
>>- -q--+-templateregistry--+--------------+-+-----------------><
                            '-=--file_path-'     

Defaults

-qnotemplateregistry

Parameters

file_path
The path for the file that will contain the template instantiation information. If you do not specify a location the compiler saves all template registry information to the file templateregistry stored in the current working directory.

Usage

Template registry files must not be shared between different programs. If there are two or more programs whose source is in the same directory, relying on the default template registry file stored in the current working directory may lead to incorrect results.

The -qtempinc and -qtemplateregistry compiler options are mutually exclusive. Specifying -qtempinc implies -qnotemplateregistry. Similarly, specifying -qtemplateregistry implies -qnotempinc. However, specifying -qnotemplateregistry does not imply -qtempinc.

Specifying either -qtempinc or -qtemplateregistry implies -qtmplinst=auto.

Predefined macros

None.

Examples

To compile the file myprogram.C and place the template registry information into the /tmp/mytemplateregistry file, enter:
 xlc++ myprogram.C -qtemplateregistry=/tmp/mytemplateregistry

Related information