C++ 20 Concepts, which can help developers write more concise C++ code, are now supported in a beta release of the upcoming Visual Studio 2019 IDE.
Supported in Visual Studio 2019 Preview 2, C++ Concepts are predicates used to express a generic algorithm’s expectations on its template arguments. Concepts allow developers to document constraints on templates that are enforced by the compiler. Compile times can be improved by Concept-based overloading.
Support for C++ Concepts is built into both the compiler and the standard library. The feature is being debuted through a
/std:c++latest mode. Once all C++ 20 features are implemented across all Visual Studio products, including the compiler, the library, IntelliSense, the builder, and the debugger, Microsoft will provide them through a
/std:c++20 mode. IntelliSense support is not currently available and Microsoft’s implementation does not yet include recent changes made in ISO C++ standards.
Specifically, the compiler supports capabilities such as:
- C++ extensions for Concepts.
- Semantic constraint matching for concepts.
Microsoft is working on support for C++ ranges, providing components for dealing with ranges of element and tightly linked to Concepts. Microsoft is seeking feedback on Concepts, which can be left on a company blog post or via the Report a Problem tool in Visual Studio.
You can download the Visual Studio 2019 preview from the Visual Studio website.