Predefined Surround Templates for C++
This topic lists all predefined surround templates for C++ in ReSharper 2017.2. For more information about surround templates, see Surrounding Code Fragments with Templates
Template | Details |
---|---|
() | Surround the selection with parentheses Scope C++ expressions, C# 2.0+ expressions Body ($SELECTION$$END$) Parameters
|
{} | Surround the selection with braces Scope C++ statements, C# 2.0+ Body {
$SELECTION$$END$
} Parameters
|
forr | Code snippet for common 'for' loop pattern with integer index and reversed iteration order Scope C++ statements Body for (int $INDEX$ = $MAX$ - 1; $INDEX$ >= 0 ; --$INDEX$)
{
$SELECTION$$END$
} Parameters
|
foreach | Code snippet for 'range-based for' loop Scope C++ statements Body for ($TYPE$ $VARIABLE$ : $COLLECTION$)
{
$SELECTION$$END$
} Parameters
|
do | Code snippet for do-while loop Scope C++ statements Body do
{
$SELECTION$$END$
} while ($EXPR$); Parameters
|
fori | Code snippet for common 'for' loop pattern with integer index Scope C++ statements Body for (int $INDEX$ = 0; $INDEX$ < $UPPER$; ++$INDEX$)
{
$SELECTION$$END$
} Parameters
|
if | Code snippet for 'if' statement Scope C++ statements Body if ($EXPR$)
{
$SELECTION$$END$
} Parameters
|
try | Code snippet for try...catch statement Scope C++ statements Body try
{
$SELECTION$$END$
}
catch ($EXCEPTION$) {} Parameters
|
while | Code snippet for 'while' statement Scope C++ statements Body while ($EXPR$)
{
$SELECTION$$END$
} Parameters
|
static_cast | Surround the selected expression with Scope C++ expressions Body static_cast<$TYPE$>($SELECTION$) Parameters
|
struct | Surround selected declarations with Scope C++ type-member declarations, C++ class declarations Body struct $NAME$
{
$SELECTION$
}; Parameters
|
dynamic_cast | Surround the selected expression with Scope C++ expressions Body dynamic_cast<$TYPE$>($SELECTION$) Parameters
|
namespace | Add a namespace to the selected code Scope C++ namespace declarations, C++ top-level declarations Body namespace
{
$SELECTION$$END$
} Parameters
|
#if...#endif | Code snippet for #if...#endif preprocessor directive Scope C++ Body #if $END$
$SELECTION$
#endif Parameters
|
const_cast | Surround the selected expression with Scope C++ expressions Body const_cast<$TYPE$>($SELECTION$) Parameters
|
reinterpret_cast | Surround the selected expression with Scope C++ expressions Body reinterpret_cast<$TYPE$>($SELECTION$) Parameters
|
cast | Cast the selection to a specific type Scope C++ expressions Body (($TYPE$) $SELECTION$) Parameters
|
namespace ... | namespace ... Scope C++ namespace declarations, C++ top-level declarations Body namespace $NAME$
{
$SELECTION$$END$
} Parameters
|
class | Add a class to the selected code Scope C++ class declarations, C++ type-member declarations Body class $NAME$
{
$SELECTION$
}; Parameters
|
incg | Surround selection with an include guard Scope C++ Body #ifndef $FILENAME$_H
#define $FILENAME$_H
$SELECTION$
#endif // $FILENAME$_H Parameters
|
if...else | Put the selection into an Scope C++ statements Body if ($COND$)
{
$SELECTION$
}
else
{
$END$
} Parameters
|