HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
Verbose Template Processing Information
Use the +inst v option to replace the cfront -ptv option tp process verbose template
information.
Common Template Migration Syntax Changes
You must use the keyword typname to distinguish types in template code in HP aC++.
Also, use the this-> notation to reference data members.
The cfront Implicit Include Convention
The preferred method for specifying template declarations and definitions in HP aC++
is to put declarations and definitions in the same file.
In HP C++ (cfront), for any .h file that contains template declarations, there is a .c file
that contains definitions for those templates.
HP aC++ provides the following options to ease migration from HP C++ (cfront):
• +inst implicit_include: This option instructs the compiler to use the cfront
default file, name lookup, for template definition files.
• +inst include_suffixes: Use this option to replace the cfront -ptS"list"
option. This specifies file name extensions for template definition files.
Converting Directed Mode to Explicit Instantiation
If you use directed mode instantiation with the cfront based compiler, an awk script can
be used to convert your file to an instantiation file that uses the explicit instantiation
syntax:
Example:
#!/usr/bin/ksh
# For a Directed-Mode Instantiation file that is the parameter
# to the script, create a file that can be compiled with the
# aC++ compiler using the Explicit Instantiation Syntax.
# (Note that this will only work for classes.)
closure_file=$1
closure_file_base_name=${1%\.*}
eis_file=$closure_file_base_name.eis.C
print “Output file: $eis_file”
# Get all of the include directives.
grep “#include” $closure_file > /tmp/dmi2eis1.$$
# Collect all of the Directed-Mode Instantiation directives.
grep -v “#include” $closure_file \
| grep -e “>” -e “<“ \
| grep -v “(“ \
| awk ‘ {if ($1 != “//”) {print $0;} }’ >/tmp/dmi2eis2.$$
Migration Considerations when Using Templates 275