JetBrains Rider 2023.1 Help

Predefined Surround Templates for C++

This topic lists all predefined surround templates for C++ in JetBrains Rider 2023.1. For more information about surround templates, see Surround code fragments with templates.

Template

Details

forr

Reversed for

Scope C++ statements

Body

for (int $INDEX$ = $MAX$ - 1; $INDEX$ >= 0 ; --$INDEX$) { $SELECTION$$END$ }

Parameters

  • INDEX - Suggests a unique name for an index variable at the evaluation point

  • MAX - no macro

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

wcerr

Write to standard error stream

Scope C++ statements

Body

std::wcerr << $END$;

Parameters

  • END - The caret position after the template is applied.

do

do while loop

Scope C++ statements

Body

do { $SELECTION$$END$ } while ($EXPR$);

Parameters

  • EXPR - Evaluates to the specified constant value

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

foreach

range-based for loop

Scope C++ statements

Body

for ($TYPE$ $VARIABLE$ : $COLLECTION$) { $SELECTION$$END$ }

Parameters

  • COLLECTION - Suggests a visible variable that can be enumerated (that is, used in a foreach loop as collection)

  • TYPE - Suggests a type for a new variable declared in the template

  • VARIABLE - When executed in a variable declaration (where variable name should stand), suggests a name for the variable

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

fori

for loop pattern with integer index

Scope C++ statements

Body

for (int $INDEX$ = 0; $INDEX$ < $MAX$; ++$INDEX$) { $SELECTION$$END$ }

Parameters

  • INDEX - Suggests a unique name for an index variable at the evaluation point

  • MAX - no macro

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

if

if statement

Scope C++ statements

Body

if ($EXPR$) { $SELECTION$$END$ }

Parameters

  • EXPR - Evaluates to the specified constant value

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

try

try catch statement

Scope C++ statements

Body

try { $SELECTION$$END$ } catch ($EXCEPTION$) {}

Parameters

  • EXCEPTION - Evaluates to the specified constant value

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

while

while statement

Scope C++ statements

Body

while ($EXPR$) { $SELECTION$$END$ }

Parameters

  • EXPR - Evaluates to the specified constant value

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

static_cast

static_cast expression

Scope C++ expressions

Body

static_cast<$TYPE$>($SELECTION$)

Parameters

  • TYPE - Guesses the type expected at this point

  • SELECTION - The text selected by the user before invoking the template.

dynamic_cast

dynamic_cast expression

Scope C++ expressions

Body

dynamic_cast<$TYPE$>($SELECTION$)

Parameters

  • TYPE - Guesses the type expected at this point

  • SELECTION - The text selected by the user before invoking the template.

namespace

Anonymous namespace declaration

Scope C++ namespace declarations

Body

namespace { $SELECTION$$END$ }

Parameters

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

#if...#endif

Code snippet for #if...#endif preprocessor directive

Scope C++, At line start

Body

#if $END$ $SELECTION$ #endif

Parameters

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

const_cast

const_cast expression

Scope C++ expressions

Body

const_cast<$TYPE$>($SELECTION$)

Parameters

  • TYPE - Guesses the type expected at this point

  • SELECTION - The text selected by the user before invoking the template.

reinterpret_cast

reinterpret_cast expression

Scope C++ expressions

Body

reinterpret_cast<$TYPE$>($SELECTION$)

Parameters

  • TYPE - Guesses the type expected at this point

  • SELECTION - The text selected by the user before invoking the template.

cast

C-like cast expression

Scope C++ expressions

Body

(($TYPE$) $SELECTION$)

Parameters

  • TYPE - Guesses the type expected at this point

  • SELECTION - The text selected by the user before invoking the template.

namespace ...

namespace declaration

Scope C++ namespace declarations

Body

namespace $NAME$ { $SELECTION$$END$ }

Parameters

  • NAME - Evaluates to the specified constant value

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

if...else

if else statement

Scope C++ statements

Body

if ($COND$) { $SELECTION$ } else { $END$ }

Parameters

  • COND - Suggests variables of the specified type

  • SELECTION - The text selected by the user before invoking the template.

  • END - The caret position after the template is applied.

Last modified: 27 March 2023