Create C++ Member Function in Visual Studio
We are excited to announce that Create C++ Member Function can now be used to quickly add constructor and equality operator (operator ==) in Visual Studio 17.6 Preview 2. When you have a class with fields, you can add a default constructor, constructor with all fields, equality operator, and equality operator with all fields easily.
Three dots will appear below a class name to indicate that you can add a member function, and you can hover over them to see the quick action (screwdriver icon). When the default constructor and equality operator are added respectively, the Go to Definition of the
operator== is displayed below, showing that the body of the equality operator would have nothing inside it.
You can also choose to add a constructor with all fields and an equality operator with all fields respectively, and the Go to Definition will show that the
operator== has all the field comparisons.
This experimental feature will be improved by adding more functions that can save you a lot of typing. Right now, it includes constructor and equality operator (
operator==) only, and we are considering adding more cases, such as assignment, swap, and hash, and would like to hear your feedback whether you are interested in these coming in future versions.
We have a Developer Community ticket to Improve “Create Member Function”, if you have the same suggestions make sure to upvote it.
Send us your feedback!
Download the latest version of Visual Studio Preview and give the Create C++ Member Function feature a try. Your feedback will be extremely helpful in shaping this experience, therefore, please continue to send your feedback in the comments below or/and via Developer Community. You can also reach us on Twitter (@VisualC), or via email at email@example.com.