" type="text/css">
Using Code Templates
Using Code Templates
See Also
The Source Editor has a set of customizable code templates
for common snippets of C and C++ code.
You can generate snippets from these code templates in either of
the following ways:
-
Type the abbreviation for the code template and then press the
spacebar to generate the full code snippet.
For example, you can type iff, followed by the spacebar, to
automatically generate if () {}.
See C and C++ Code Template
Abbreviations: Quick Reference for a
list of abbreviations
-
Type the first few characters of the template, press Ctrl-Spacebar,
and select the code template from the code completion box.
For example, to generate for (int i = 0; i < ; i++) {},
you can type fori, press Ctrl-Spacebar, press the down
arrow key twice, and press Enter.
To keep a code template abbreviation from expanding into the full
code snippet, type Shift-Spacebar after typing the abbreviation.
There are also multi-line templates that provide the following
benefits:
-
You can navigate between variables in the code snippet by pressing
the Tab key.
-
When you fill in the first occurrence of a variable name that needs
to be repeated in the snippet, the variable is filled in
automatically in the other places.
-
If the IDE detects that you have declared a variable that might be
relevant to the code snippet, the IDE fills in that variable for you.
Legal Notices