"Compiling"
Templates requires maintenance ance from the programming environment.
Language defines two broad strategies for instantiating templates:
Dimensional Model and the separate compilation model. These models have
Imptts on how we build our systems in so far as they dictate whether
Template definitions go in header files or source files. At this time,
All impilers implements the compression sion model, while only some implement
The separate compilation model. Your Compiler's User's Guide shoshould
Specify how your system manages templates ."
This is a piece of code derived from C ++ primer. compiling a template requires the support of the compiler. The language provides two policies for template instantiation: including the model and compiling the model separately. These models determine whether the template definition should be placed in the header file or the source file. All the compilers implement include models, while only a few compilers compile models separately.
Therefore, the definition of generic functions does not have to be written in the header file. However, if you use C ++ to write generic functions, write the function definition in the header file.
previously, I noticed this problem using the model. I will record it for the time being, and stay in the future for further research.