Predefined Live Templates for C++
This topic lists all predefined live templates for C++ in ReSharper 2024.2. For more information about live templates, refer to Create source code using live templates.
Template | Details |
---|---|
| Current file context Scope Everywhere Body $CTX$ Parameters
|
| Insert new GUID Scope Everywhere Body $GUID$ Parameters
|
| union declaration Scope C++ type-member declarations, C++ class declarations Body union $NAME$ {$END$}; Parameters
|
| Write to standard output stream Scope C++ statements Body std::wcout << $END$; Parameters
|
| Write to standard log stream Scope C++ statements Body std::wclog << $END$; Parameters
|
| Copy constructor declaration with body Scope C++ type-member declarations Body $CLASSNAME$($CONSTCLASSNAME$ & $NAME$){$END$} Parameters
|
| Read from standard input stream Scope C++ statements Body std::wcin >> $END$; Parameters
|
| Default constructor declaration with body Scope C++ type-member declarations Body $CLASSNAME$(){$END$} Parameters
|
| Move constructor declaration with body Scope C++ type-member declarations Body $CLASSNAME$($CLASSNAME$ && $NAME$) noexcept {$END$} Parameters
|
| else statement Scope C++ statements Body else
{
$END$
} Parameters
|
| Virtual destructor declaration with body Scope C++ type-member declarations Body virtual ~$CLASSNAME$(){$END$} Parameters
|
| Function 'to_string' for enum Scope C++ namespace declarations Body const char * to_string($ENUM$ e) {
switch (e) {
case $ENUMERATOR$: return $ENUMERATOR_NAME$;
default: return "unknown";
}
} Parameters
This template is expanded when you invoke the Convert enum to string context action on an enum declaration. |
| Destructor declaration with body Scope C++ type-member declarations Body ~$CLASSNAME$(){$END$} Parameters
|
| Enum class declaration Scope C++ type-member declarations, C++ class declarations Body enum class $NAME$ {$END$}; Parameters
|
| Reversed for Scope C++ statements Body for (int $INDEX$ = $MAX$ - 1; $INDEX$ >= 0 ; --$INDEX$)
{
$SELECTION$$END$
} Parameters
|
| Write to standard log stream Scope C++ statements Body std::clog << $END$; Parameters
|
| Documentation template Scope C++ comments Body /**
* \brief $END$
* \tparam $TNAME$ $TDESCRIPTION$
* \param $PNAME$ $PDESCRIPTION$
* \param $MNAME$ $MDESCRIPTION$
* \return $RETURN$
*/ Parameters
This template is expanded when you invoke the Document context action on a type or type member. |
| Write to standard error stream Scope C++ statements Body std::wcerr << $END$; Parameters
|
| Write to standard error stream Scope C++ statements Body std::cerr << $END$; Parameters
|
| Read from standard input stream Scope C++ statements Body std::cin >> $END$; Parameters
|
| Class declaration Scope C++ class declarations, C++ type-member declarations Body class $NAME$ {public:$END$}; Parameters
|
| Write to standard output stream Scope C++ statements Body std::cout << $END$; Parameters
|
| do while loop Scope C++ statements Body do
{
$SELECTION$$END$
} while ($EXPR$); Parameters
|
| Enum declaration Scope C++ class declarations, C++ type-member declarations Body enum $NAME$ {$END$}; Parameters
|
| range-based for loop Scope C++ statements Body for ($TYPE$ $VARIABLE$ : $COLLECTION$)
{
$SELECTION$$END$
} Parameters
|
| for loop pattern with integer index Scope C++ statements Body for (int $INDEX$ = 0; $INDEX$ < $MAX$; ++$INDEX$)
{
$SELECTION$$END$
} Parameters
|
| if statement Scope C++ statements Body if ($EXPR$)
{
$SELECTION$$END$
} Parameters
|
| Include guard Scope C++ top-level declarations, At line start Body #ifndef $FILENAME$
#define $FILENAME$
$END$
#endif // $FILENAME$
Parameters
|
| main declaration Scope C++ top-level declarations Body int main(int argc, char *argv[])
{
$END$
}
Parameters
|
| namespace declaration Scope C++ namespace declarations Body namespace $NAME$ {$END$} Parameters
|
| struct declaration Scope C++ class declarations, C++ type-member declarations Body struct $NAME$ {$END$}; Parameters
|
| switch statement Scope C++ statements Body switch ($EXPRESSION$) {$END$} Parameters
|
| try catch statement Scope C++ statements Body try
{
$SELECTION$$END$
}
catch ($EXCEPTION$) {} Parameters
|
| while statement Scope C++ statements Body while ($EXPR$)
{
$SELECTION$$END$
} Parameters
|
| UCLASS declaration Scope C++ class declarations, Unreal Engine header files Body UCLASS()
class $NAME$:public $BASE$ {GENERATED_BODY() public:$END$}; Parameters
|
| UENUM declaration Scope C++ class declarations, Unreal Engine header files Body UENUM()
enum $NAME$ {$END$}; Parameters
|
| UENUM declaration using the "enum class" syntax Scope C++ class declarations, Unreal Engine header files Body UENUM()
enum class $NAME$ {$END$}; Parameters
|
| UINTERFACE declaration Scope C++ class declarations, Unreal Engine header files Body UINTERFACE()
class U$NAME$:public UInterface {GENERATED_BODY()};
class I$NAME$ {GENERATED_BODY() public:$END$}; Parameters
|
| USTRUCT declaration Scope C++ class declarations, Unreal Engine header files Body USTRUCT()
struct $NAME$ {GENERATED_BODY() $END$}; Parameters
|