Coding Assistance in C++
Most of ReSharper's coding assistance features are also supported in C++. You can find the detailed information on these features in the corresponding topics of the Coding Assistance section. In the main topic of the section, you can also find the feature matrix and check what exactly is supported in C++.
In this topic, you can find some examples of using coding assistance features in C++.
By default, code inspection, quick-fixes, and context actions are available in all solution files. If necessary, you can enable these features in external files referenced from solution with the Enable inspections, quick fixes and context actions in files external to the solution checkbox on the page of ReSharper options (Alt+R,,O).
Code completion
Automatic and basic completion
In C++ files, you can use automatic and basic Ctrl+Space completion when writing your code. For example, you can quickly add enum members taken from a different namespace:

The selected completion item displays a popup with syntax-highlighted signature and documentation. If necessary, you can disable this popup by clearing the Show summary checkbox on the page of ReSharper options (Alt+R,,O).

Import symbol completion
When a symbol that you want to use is not imported in the current file with the corresponding #include
, but it is defined in the standard libraries or elsewhere in your solution, you can press Ctrl+Alt+Space to quickly find this symbol in completion suggestions:
Note that this comes with a performance hit (since each time when ReSharper builds a completion list, it has to look at all the symbols in the solution to match them), so it is disabled by default.
Dot/arrow completion helpers
When you call a method, you can always type a dot .
or an arrow ->
and get all available methods in the completion list. The methods that do not match .
/->
are displayed in grey. If you choose such method, the .
/->
will be corrected automatically:

Generative completion
Generative completion suggestion are also available. For example, when you call a member function declaration on the object...

ReSharper generates the following function:

Postfix completion
Postfix completion in C++ is very much like C# extension methods. If you type a dot .
or an arrow ->
after an expression, ReSharper will suggest free functions that would accept that expression as the first parameter. When you accept the suggestion, ReSharper will rewrite your code so that the expression is passed as the first argument:

Postfix completion also includes postfix templates which, instead of looking up for suitable methods, let you quickly wrap an expression with frequently used language constructs.
Free functions in code completion
One common C++ coding practice is to prefer non-member non-friend functions to member functions. This is a great way to increase encapsulation and keep class interfaces as minimal as possible. When you type a dot .
or an arrow ->
after an expression, free functions that accept the expression as the first parameter will be suggested in the completion list after member functions:

If you do not want to have free functions in the completion suggestions, you can clear the corresponding checkbox on the page of ReSharper options (Alt+R,,O).
Code completion in dependent code
ReSharper automatically uses default template arguments to provide completion suggestions in dependent code. When typing inside a template body, code completion may be unavailable if there is no type information for parameters. However, for template parameters that have default arguments ReSharper will provide completion suggestions based on those default arguments.

Syntax highlighting and tooltips
By default, ReSharper provides extended highlighting of C++ syntax with configurable colors. If necessary, you can disable it on the There are 20 identifier types that you can highlight differently. You can change colors and fonts at any time in Visual Studio options ( ).
page of ReSharper options.
ReSharper also replaces Visual Studio tooltips for code elements with its own tooltips, which have highlighted syntax, display method and field signatures, formatted XML and Doxygen comments:

If necessary, you can disable ReSharper tooltips by clearing the Replace Visual Studio tooltips checkbox on the page of ReSharper options.
Inlay hints
Parameter name hints are editor adornments that show parameter names next to the corresponding arguments at method calls. They can help you find your way through long (and sometimes nested) lists of parameters in function calls and aggregate initialization.
In the example below, parameter name hints help spotting the fact that height and width arguments are mixed up:

Namespace name hints at the end of namespace definitions could be helpful if you are not following the LLVM or Google guidelines, which suggest adding namespace in a comment after the namespace closing bracket.
Preprocessor directive hints help you quickly understand how conditional inclusions (#ifdef
, #ifndef
, #if
, #endif
, #else
, and #elif
) correspond to macro definitions:
Type name hints will help disentangle complex aggregate initializations in C++17 and later:
There are reference hints for function arguments passed by a non-const reference:
There are granular configuration options for parameter and namespace name hints.
Parameter information
Whenever you are writing or studying a function call, ReSharper helps you view details on the allowed arguments for all overloads of the function. In a tooltip, you will see all public signatures with parameters and brief description taken from the function's documentation, if any.
As you are typing parameters, ReSharper automatically highlights the next signature compatible with the entered parameters, and grays out inapplicable signatures. To study alternative signatures of an existing function call, set the caret inside the function's parentheses and then press Ctrl+P or choose
from the main menu.
The Parameter info tooltip also provides details about members of the aggregate class when performing aggregate initialization, shows information for user-defined binary operators, deleted functions and implicitly generated functions.
On dependent code, it takes template parameter descriptions from documentation comments for template arguments as well as uses default template arguments to provide information about parameters in the dependent code.

The Parameter info tooltip is configurable on the
page of ReSharper options.Context Actions
ReSharper provides a set of context actions that target C++ code. You can find the full list of these actions in the Code Editing | C++ | Context actions page of ReSharper Options. If necessary, you can also disable some of the actions using this page.
As soon as a context action becomes available for the current caret position, ReSharper displays the corresponding action indicator to the left of the caret. Sometimes however, ReSharper provides several contextually available features for the current caret position. In this case, the action indicator corresponding to the action with the highest priority is shown, and all other actions only appear when you expand the action list by clicking on the action indicator or pressing Alt+Enter Context actions have the lowest priority, therefore, they often appear at the bottom of the action list.
Here are some examples of context actions for C++:
Convert enum to string (generate enum-to-string helper)
This context action generates a helper function for a specific enum that converts its enumerators to corresponding strings.
For example, if you invoke this action on the following enum:
ReSharper will generate the following function for you:
If necessary, you can customize generated function by editing the enum_to_string live template that ReSharper uses for generation. For example, you can configure the template to generate stream output operator overload:
Generate missing case statements
Instead of manually writing all case statements when switching over an enum, you can use the context action that generates all missing case statements:
Merge nested 'if' statements
ReSharper helps you merge nested 'if' statements with the context action:
Generate implementation
ReSharper helps you automatically create a stub implementation of a function or a method. You can always generate an inline implementation and, if the function is defined in a header file and there is the corresponding source file, you can generate the implementation in the source file.

Move implementation out of class scope
ReSharper helps you move the implementation of a function or a method from a header to the corresponding source file if it exists. After applying this context action the definition is left in its original place and the implementation is moved to the source file. The editor context is switched to the source file as well.

You can also use the context action to move all implementations in the current selection.
Highlighting paired items
ReSharper highlights various matching items when you set the caret to one item of the pair:
Matching delimiters (
()
,[]
,{}
, and<>
)Matching macros, for example,
BEGIN_NAMESPACE
/END_NAMESPACE
Matching format specifier and argument in
printf
andboost::format