What’s New in ReSharper C++ 2016.1
Apart from the change in version numbers, ReSharper C++ comes with plenty of new features as well as improvements to existing functionality. Here’s what we’ve got in store for you with this release.
The previous release of ReSharper C++ provided a unit test runner for Google Test — well, this one augments this with Boost.Test support. This includes all the usual refinements users of our unit test infrastructure are used to. ReSharper will detect individual Boost tests as well as test suites:
There is also support for test labels:
And of course it will use its unit test runner to actually run those tests and show a listing of the results.
Please note that Boost.Test support requires Boost 1.59 or later.
The Todo Explorer is a separate tool window that has long existed in the original ReSharper but is now coming to ReSharper C++. Its goal is to find text that matches a specific pattern in comments, strings or identifiers and show all the located elements in a single, easy-to-browse list:
There are plenty of filtering and grouping options in this window, and double-clicking each element takes you right to the line of code where the relevant piece of information was found. ReSharper comes with support for
BUG in comments, but you can easily add other markers or create new ones:
As the above screenshot demonstrates, you can define the regular expression to search for, the type of code element (comments, strings, identifiers) to search in, and you can also control the color that’s used for this type of item in the Todo Explorer.
Context Actions and Quick-Fixes
As with all releases, we keep expanding the set of context actions and quick-fixes that ReSharper C++ provides. Here are a few examples.
If an out-of-class member function signature fails to match the prototype in the class body, ReSharper C++ now offers two quick-fixes to change that:
Choosing Use signature…, the signature of the function definition will be changed to the one of its declaration. Choosing Change signature… does the reverse, changing the declaration so that it matches the definition.
When ReSharper C++ detects an uninitialized constructor parameter, we now offer a context action to create and initialize the corresponding field
When ReSharper C++ detects possible unintended object slicing, it offers the option to perform a
If the type of variable being returned from a function does not match the type in the function signature, ReSharper C++ offers the options to adjust either the return type or the type of variable being returned:
In fact, we have a more general mechanism for detecting type mismatches: for example, assigning an
int variable a string literal will present you with the following:
If you try to assign a read-only member in a
const function, ReSharper C++ now offers you quick-fixes to either to make the member
mutable or make the function non-
If a base class or its function has a
final modifier, ReSharper C++ will highlight the error over both the
final keyword as well as any overriding classes and offer you a quick-fix to make the base class non-
New context actions are also provided to flip operator arguments and negate boolean expressions:
We’ve added fixes and context actions for working with includes: analyses related to precompiled header usage, context actions to normalize slashes in include paths, support for replacement of quotes with angle brackets (and vise versa).
In addition to the bulk generate definitions action, we now have bulk Move Function Implementations context action. Simply select several function bodies and press Alt+Enter:
Rename Refactoring Improvements
And there are additional fixes, too. For example, the Rename refactoring now works on files, and will rename both the file as well as any usage (e.g., in
#include directives) of the file:
It’s also worth noting that the Rename behavior on an ordinary class will now affect the header/cpp filenames, too.
We’ve made improvements in the code generation functionality. For example, when generating relational operators, ReSharper C++ now offers the option of using
Another feature we’ve added to the Generate stream operations feature is the support for the use of Boost for purposes of serialization:
And a Few More Things
Starting with version 2016.1, the Find Code Issues functionality works in the background in both ReSharper and ReSharper C++. This lets you keep editing or navigating your code while ReSharper runs its analysis.
The list of C++ language features supported by ReSharper C++ has also been extended with support for generalized lambda captures, exception specifications and inheriting constructors. We also have formatting options now being taken into account when generating code.
The formatting settings have a new page for controlling blank lines.
Finally, all ReSharper C++ actions are now actively banned from changing the code of any of the C++ libraries that you might be using.
So that’s it! Enjoy the new release of ReSharper C++, and be sure to let us know what you think!