New inlay hints make hidden type conversions visible in the editor, so that you are aware of their potential performance and correctness implications.
You will see special icons for implicit conversions. Alternatively, you can choose to show the conversions as textual hints.
ReSharper C++ displays hints for different kinds of class type conversions, including object copying, object initialization using converting constructors or aggregate initialization, and calls to conversion operators.
You can also enable hints for standard conversions between built-in types, for example, conversions between numeric types that might lose precision or change the signedness of the type.
Immutability-related analyses can help you keep your code more readable and correct. By adding two new inspections, ReSharper C++ now covers all the rules from the Constants and immutability section of the C++ Core Guidelines.
The first new inspection extends the immutability analysis for function parameters
of reference and pointer types. ReSharper C++ will notify
you if you can pass a pointer or a reference to
const, which guarantees that the
function will not modify the corresponding function argument.
The second inspection suggests marking variables that can be evaluated at
constexpr, which can lead to faster performance and
better compile-time checking.
ReSharper C++ 2021.2 includes some new inspections to help you modernize your code.
Structured binding can be used instead of tie(..): since C++17, you no longer
need to use
boost::tie() for unpacking a tuple
or a pair – structured binding declarations help you simplify your code.
Type trait can be simplified using a template alias or a variable template: C++14 alias templates let you shorten C++11 type trait expressions.
std::size can be used: this inspection suggests using
as a type-safe alternative to the error-prone C idiom for array size calculation.
Zero initialization can be used instead of memset: zero-initialization leads
to more concise code and prevents various
The new Inline Function refactoring lets you quickly replace a function call with the body of the function. To invoke it, place the caret on a function call and select Inline Function from the Refactor This menu, or choose ReSharper | Refactor | Inline from the main menu. ReSharper C++ will perform the necessary transformations, handle all the name conflicts, and reformat the resulting code.
By default, ReSharper C++ generates functions with empty bodies, but now you can
specify whether the generated functions should throw an
return a default value, or include uncompilable code. To configure this, go to
ReSharper | Options | Code Editing | C++ | Code Generation.
ReSharper C++ will also automatically call the base function
from the body of an overriding function.
A new context action lets you convert any string into a C++11 raw string literal, which is easier to read when the string literal contains special characters. The transformation works both ways, so you can convert a raw string literal into a regular string literal, too.
If you want to quickly consult cppreference.com about the details of a standard library class or function, you can now click Read more in the Quick Documentation pop-up (Ctrl+Shift+F1) to open the corresponding page in your browser.
When you press Backspace on an empty line or a line with whitespaces or tabs to the left of the caret, ReSharper C++ can now place the caret at the proper indent position instead of moving it back one position at a time.
ReSharper C++ 2021.2 supports working with Unreal Engine 5 from both the Unreal Launcher and GitHub sources.
In the .Build.cs and .Target.cs files of an Unreal Engine project, ReSharper C++’s code completion now suggests the list of available modules and plugins.
After you’ve added a module or a plugin, the new inspection for missing dependencies will highlight any that must be referenced in the .uproject or .uplugin file. Use the accompanying quick-fix to add new modules and plugins to the project files with a single click.
When generating a definition of an overriding function,
ReSharper C++ will now call the overridden function
from the generated body using the idiomatic
Super type alias.
We've improved the performance and memory usage of a cold startup. Now ReSharper C++ indexes the Unreal Engine codebase 10% faster.
The bundled Clang-Tidy has been updated to Clang 12, adding new checks from the latest LLVM release. We’ve also improved its performance in complex files, particularly in C++20 projects.
A new inspection warns you when you compare an unsigned expression with 0, which may cause an infinite loop or unreachable code.
Take a look at What's New in ReSharper to learn about the other changes coming to the ReSharper platform. For example, the InspectCode command line tool now restores NuGet packages and builds a solution before starting its analysis.
Free 30-day trial
ReSharper C++ 2021.1 adds support for class types in non-type template parameters. With this C++20 feature, you can use your own classes in the types of template parameters when the class satisfies certain requirements.
Another useful addition is the support for C++20 CTAD rules: class template argument deduction now works for aggregate templates, type aliases, and inherited constructors.
Since C++17, the noexcept specification has been considered a part of the function type, and ReSharper C++ now fully supports the new exception specification semantics.
Up until now, code completion didn't include support for the C++20 coroutines-related syntax. Now
co_return are available both in basic code completion and as postfix completion templates.
ReSharper C++ will now notify you when a variable is declared before the scope in which it's used. In this case, you can use the provided quick-fix to move the variable and limit its scope.
Another new inspection detects redundant cast expressions, which can be safely eliminated from code without changing its semantics.
ReSharper C++ 2021.1 includes new quick-fixes for
errors: choose one of the conversions suitable for the current context (
to_string(), etc.) to resolve the error.
ReSharper C++ 2021.1 also highlights redundant template arguments that can be deduced by the language according to the C++17 class template argument deduction rules.
With the 2021.1 release, we've introduced a collection of syntax style settings that you can use to make ReSharper follow your chosen code style and enforce it throughout your entire codebase.
You can customize your syntax style preferences on the Code Editing | C++ | Syntax Style page. The selected option value will be used both for code generation and for code style enforcement.
ReSharper C++ will highlight style violations and offer you quick-fixes to help eliminate them. All syntax style quick-fixes can be applied in scope, including in local scopes like function bodies or class definitions.
Enabling all the style inspections can be overwhelming, so we've made sure that context actions are always available for tuning your code even if you’ve muted the corresponding inspections.
To enforce the chosen syntax style, you can use code cleanup or the dedicated Apply Syntax Style action, which will fix syntax style issues in the selection, the entire current file, or a set of files depending on the current context.
Several new syntax style settings let you configure and enforce the style of declarations in your code.
You can choose whether to prefer typedefs or use alias declarations instead. In function declarations, you can enforce trailing return types or configure ReSharper C++ to require regular return types. You can also specify whether to use C++17 nested namespace definitions where possible.
You can specify when ReSharper C++ should require
auto instead of an explicit type in variable declarations. By default,
auto is now suggested only when the deduced type is evident from the surrounding context.
Syntax style settings for the position of cv-qualifiers let you choose the east const or the west const style, and quickly update your code to use one or another.
You can also choose which of the
override specifiers (or both) should be used on
overriding functions and destructors.
In C++ braces can be omitted around single nested statements, but code style guidelines may still require braces in certain cases. To help you enforce the braces style, ReSharper C++ adds syntax style rules for the use of braces.
You can choose whether to always enforce braces, or you can require braces only for multi-line statements or around multi-line statement bodies. ReSharper C++ can also find and remove redundant braces that do not conform to the chosen braces style.
All the new syntax style checks have received a corresponding code cleanup option and can be disabled in custom profiles. There are also two new options to remove redundant casts and template argument lists.
The new Cleanup selection context action lets you quickly run code cleanup on the selected code range. You can also conveniently choose one of the custom code cleanup profiles to use during the run.
Finally, we've improved the performance of code cleanup. In many cases, code cleanup now spends less time analyzing code and performs fewer operations, finishing faster on real-world codebases.
We've introduced initial support for Unreal Engine 5 based on feedback from the Epic Games team.
Unreal Engine's Cast for type-safe dynamic casting is now available as a postfix template in code completion.
ReSharper C++ adds support for another Unreal Engine specific reflection macro,
RIGVM_METHOD, and now handles it correctly.
Take a look at What's New in ReSharper to learn about other changes coming to the ReSharper platform. For example, there is a new navigation action, Navigate to Windows Explorer, and an action for creating links to GitHub sources with the Copy FQN feature.
ReSharper C++ 2020.3 provides seamless integration with UnrealHeaderTool to help you catch more issues with Unreal Engine class metadata right in the editor. When working with an Unreal Engine project, ReSharper C++ automatically runs UnrealHeaderTool on the file you’re editing and displays any errors or warnings, just like with other inspections. Watch the UnrealHeaderTool integration in action.
To always keep you up to date, ReSharper C++ now tracks Unreal Engine properties in real time and regenerates the project model as soon as you save any changes in .Build.cs, .Target.cs, .uproject, or .uplugin files.
ReSharper C++ 2020.3 improves its conformance to the Unreal Engine coding standard. For example,
ReSharper C++ now suggests using MoveTemp
(Unreal Engine's equivalent of
std::move) for casting to an rvalue reference.
ReSharper C++ 2020.3 fully supports C++20 comparison rules. This includes a significant change to how comparisons work, where the language is allowed to rewrite a comparison expression or reverse the order of arguments. You can now consult the tooltip to learn how an expression has been rewritten. When a comparison operator cannot be resolved, the error message will list all the considered overloading candidates.
Defaulted comparison operators are another addition to C++20. If you are not sure why a defaulted comparison operator in your class has been implicitly deleted, you can check the detailed tooltip message to find out the exact reason. ReSharper C++ can now also deduce the return type of a defaulted three-way comparison operator.
A new quick-fix lets you quickly add an
#include <compare> directive to
your source file, which is required whenever you use a three-way comparison operator that
returns a standard comparison category, such as
The Create operator from usage quick-fix has been updated to support C++20 comparison rules as well. You can now create both the member and the friend versions of an operator in addition to the non-member version. For secondary operators, which can be rewritten in terms of a primary one, you can choose to create either the primary or the secondary operator.
The full power of ReSharper's control-flow analysis now comes to HLSL shader files, including warnings about unreachable code, uninitialized variables, redundant control flow jumps and conditional branches, and much more.
ReSharper C++ 2020.3 offers two inspections with quick-fixes to help you adopt the new C++20 ranges library and modernize your code:
valuescan be used.
A new inspection suggests replacing usages of standard algorithms that accept a pair of iterators with equivalent algorithms that accept an iterator and a count where possible.
ReSharper C++ provides many kinds of inlay hints. While all of the hints are useful in certain scenarios, we’ve also heard feedback that sometimes they can be overwhelming. To help address this, we’ve come up with a new "Push-to-Hint" mechanism for inlay hints. In the Push-to-Hint visibility mode, hints are only shown when you either press and hold Ctrl, or press Ctrl twice.
We've made sure that the visibility mode can be configured separately for every kind of C++ inlay hint. You can quickly change the visibility mode for a given hint using the context menu, or head to the new option pages under Environment | Inlay Hints | C++ to check out all the settings.
A new context action helps you invert ternary operator expressions.
The "Join declaration and assignment" quick-fix is now available for cases when a local variable is reassigned in all paths before being read.
With import completion enabled, the completion list will suggest suitable members of incomplete classes from the header files that are not included in the current file.
Import completion now also suggests a new option to add an elaborated type specifier for the corresponding class, in addition to the options to add an include directive or a forward declaration.
We've improved argument code completion for library functions that accept macro constants. Library macro constants that are applicable to the current argument are now prioritized in the completion list. This heuristic works for functions from the standard library, WinAPI, and OpenGL.
In addition to its regular search, Find Text now performs a fuzzy search, which
means it takes possible typos and missing words into account. This feature can be very
helpful if you are looking for a certain format string used as an argument to a text
formatting function like
You can now use Go to Declaration to jump between matching preprocessor directives,
such as branches of a conditional preprocessing block, or the
#undef of the same macro in a single file.
Go to Declaration can also be used to quickly navigate to a base function – just
invoke it on an
Peek Implementations and Peek Base Symbols come to C++, allowing you to view and edit code in a popup window without switching away from the code you're writing.
For better readability, File Structure now uses the C++17 syntax for nested namespaces even if you have not yet adopted the new syntax in your codebase.
Go to Derived Symbols works for
set functions inside
C++/CLI properties and for
remove functions inside C++/CLI events.
Take a look at What's New in ReSharper to learn about other changes coming to the ReSharper platform. For example, command-line tools now support plugins, and you can invoke CleanupCode on a specific set of files or folders instead of the whole solution.