COMPILER COMPLICATIONS Many compilers do not allow separate compilation of templates, so you may need to include your template definition with your code that uses it. As usual, at least the function declaration must precede any use of the function template. Some C++ compilers have additional special requirements for using templates. If you have trouble compiling your templates, check your manuals or check with a local expert. You may need to set spe- cial options or rearrange the way you order the template definitions and the other items in your files. The template program layout that seems to work with the widest selection of compilers is the fol- lowing: Place the template definition in the same file in which it is used and have the template definition precede all uses (all invocations) of the template. If you want to place your function template definition in a file separate from your application program, you can #include the file with the function template definition in the application file. |
export
keyword for separate template compilation.