Order functions in .cpp files to match order in .h files in Visual Studio 2015?

空扰寡人 提交于 2019-12-23 04:23:00

问题


I've written a lot of functions without paying attention to their order and it has gotten kind of messy.

I want to make my code more readable by having the order of functions in my .cpp files match the order in the .h files. Is there a way to do this automatically in Visual Studio 2015 or do I have to do it manually?

What other options are there to automatically format my code to make it more readable in Visual Studio 2015?


回答1:


There isn't a built-in feature to do this. However you can collapse all of your implementations using Ctrl+M then Ctrl+O to make it easier to manipulate them. Ctrl+M then Ctrl+P disabled outlining after your done.

For the second part of your question, press Ctrl+K then Ctrl+F to automatically format any highlighted code. Ctrl+K then Ctrl+D automatically formats the entire document. The formatting rules are controlled in Tools->Options...->Text Editor->C/C++.

Other useful shortcuts can be found in Edit->Advanced or Edit->Outlining.



来源:https://stackoverflow.com/questions/41470590/order-functions-in-cpp-files-to-match-order-in-h-files-in-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!