ReSharper C++ 2020.1 EAP: Template Syntax for Lambdas, and Better Support for UE4 Coding Standard
The latest ReSharper C++ EAP build brings mostly bug fixes, but also includes some new features and enhancements. Long story short, we’re introducing a new inspection with a quick-fix to use an explicit template parameter list in a generic lambda. Also, when ReSharper C++ detects an Unreal Engine 4 project, it now overrides the default settings related to the
auto keyword to better conform to UE4’s coding standards.
Download the new ReSharper C++ EAP build from our website, or update using the Toolbox App.
Let’s take a closer look at these highlights!
Template syntax for lambdas
Starting with C++20, a lambda definition can use an explicit template parameter list. ReSharper C++ now has a new inspection to detect when you can use this new syntax, which can help you avoid errors or unify your use of lambdas and functions.
When you retrieve the parameter type of a generic lambda using
decltype, you have to take care of the const, volatile, and reference specifiers. The best way to avoid problems is to use explicit template parameters:
If the parameter’s type is an rvalue reference, you may want to pass that type directly to
std::forward. In this case, you can now use a single perfect forwarding syntax for both lambdas and functions:
UE4: the auto keyword
We are working closely with the Epic Games team to improve our Unreal Engine support and better align it with their guidelines and overall practices.
In gamedev projects, it’s very important that specific types are apparent to the reader. That is why Unreal Engine 4 coding standards and conventions recommend against overusing the
auto keyword. There are several exceptions, but the general rule is always to be explicit about the type. Starting with 2020.1, ReSharper C++ will tweak its default settings to stop suggesting “Use auto” for your UE4 projects.
There are also loads of bug fixes, so check out the full list in our issue tracker. Feel free to submit a new issue or feature request!
Your ReSharper C++ team
The Drive to Develop