" type="text/css"> Creating and Customizing Code Templates

Creating and Customizing Code Templates

See Also

To customize the list of code templates:

  1. Choose Tools > Options.
  2. Click Editor and select the Code Templates tab.
  3. Select cc from the Language drop-down list to display the code template list for C and C++.
  4. Edit, create, and remove templates according to your wishes.

Special Code Template Syntax

When you use the Options window to create code templates, there are several constructs that you can use to customize the way the code template behaves. The table below lists these constructs.

Code Template Syntax Construct Explanation
${cursor} Indicates where the insertion point should go after the code snippet has been added to your code.
${Identifier} Indicates an identifer that needs to be filled in when you use the code template. When you use this construct in a template definition, replace Identifier with the identifer name that you want to appear in the template.
index An attribute that you can use within a ${Identifier} segment to designate that an unused variable name should be generated in the code snippet. For example, you could use ${ind?index}.
instanceof="FullyQualifiedType" An attribute that you can use within a ${Identifier} segment to designate the type that the identifier must represent an instance of.
See Also
Using Code Templates

Legal Notices