Hello C ++ World!
Last Friday, the release of Visual Studio 2015 Preview was released, in which new features were presented to increase development productivity, including C ++ code refactoring. To a large extent, the feedback from the community, which was obtained during the testing of Visual Studio "14" CTPs, influenced the implementation of this functionality, so thanks to everyone who participated.
In this article, we will consider the following features of Visual Studio 2015 Preview for working on C ++ code, like:
- Rename
- Extract Function
- Generating stubs of pure virtual methods (Implement Pure Virtuals)
- Generate declarations / stub methods (Create Declaration / Definition)
- Move function declarations (Move Function Definition)
- Convert to Raw-String (Convert to Raw-String Literal)
Renaming is by far the most frequently needed tool. Thus, we placed it at the very top of the context menu with a right click on the class \ function \ variable. In addition, you can activate it by double-clicking the Ctrl + R combination. The tool itself is two-step - in the first window you specify the rename settings, the second window shows the preview.
')


Helpful hints
- You can turn off the search for the renamed symbol in comments and string literals in the first window (checkmark “Search comments / strings”)
- You can also enable viewing of characters found in comments and strings, but do not rename them (tick “Rename comments / strings”)
- More information about this feature you can find here in this video.
Extraction of the function was the second by the number of feature requests. We are still in the process of working on it, so for now it has been implemented as an
extension . After installing it, select the block of code that you want to select into a separate function, then right-click and select “Extract Function / Method” in the “Refactor ...” menu.

Helpful hints
- The tool has some means of code validation, but still for normal work try to isolate a valid, integral block of code.
- The retrieved function saves context. This means that if you extract a piece of code from a method of a class, the new function will be a method of the same class.
Generation of stubs of virtual methods allows you to create the bodies of all purely virtual methods in the inherited class. Multiple inheritance is supported. The tool is called from the context menu of the class declaration.

Helpful hints
- The tool generates method declarations in the header file, and the stubs themselves are in a cpp file.
- You can trigger the generation of stubs for only one of the base classes, from the context menu of the name of this class in the declaration of the inherited class:
- The undo operation will remove all generated stubs, but will not delete the cpp file if it was created in the previous step.
- More information about this tool can be found in this video.
Important point : all the above functions only work when IntelliSense is enabled.
Generating method declarations / stubs allows you to quickly generate a missing declaration or method body stub.


Helpful hints
- Methods that have a body but are not defined in the header file will be underlined by a wavy green line.
- You can generate definitions \ stubs for several methods at once (select all and select in the context menu "Refactor-> Create Declaration / Definition")
- More information about this tool can be found in this video.
Moving method declarations allows you to quickly move the method body from a header file to a cpp file or vice versa.

Helpful hints
- More information about this tool can be found in this video.
Conversion to Raw-String allows you to convert any string to Raw-String, which greatly improves the readability of strings with escape sequences. The function is called from the context menu anywhere in the line.

Helpful hints
- Currently, only the following characters are supported: \ n, \ t, \ ', \ ", \?
- If you have other escape sequences in your line, you will receive an error message.
- There is no reverse conversion - use undo