JetBrains Rider 2024.3 Help

Predefined Surround Templates for C/C++

This topic lists all predefined surround templates for C/C++ in JetBrains Rider 2024.3. For more information about surround templates, refer to Surround code fragments with templates.

Template

Details

forr

Reversed for

Scope C/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/C++ statements

Body

std::wcerr << $END$;

Parameters

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

do

do while loop

Scope C/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/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/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/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/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/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/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/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

Scope C/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/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/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/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.

include_guard

Include guard surround template

Scope C/C++ top-level declarations, At line start

Body

#ifndef $FILENAME$ #define $FILENAME$ $SELECTION$ #endif // $FILENAME$

Parameters

  • FILENAME - Evaluates to the current file name in uppercase with all non-alphanumeric characters replaced with underscores

  • DATE - Evaluates to file creation date and time of the current file

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

if...else

if else statement

Scope C/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: 07 November 2024