在.cpp文件中命令函数以匹配Visual Studio 2015中的.h文件中的顺序? [英] Order functions in .cpp files to match order in .h files in Visual Studio 2015?

查看:334
本文介绍了在.cpp文件中命令函数以匹配Visual Studio 2015中的.h文件中的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了很多函数,没有注意到它们的顺序,而且已经变得很混乱。

我希望通过让我的代码更具可读性.cpp文件中的函数顺序与.h文件中的顺序相匹配。有没有办法在Visual Studio 2015中自动执行此操作,或者我必须手动执行此操作?



有什么其他选项可以自动格式化代码在Visual Studio 2015中可读?

解决方案

没有一个内置的功能来做到这一点。但是,您可以使用Ctrl + M然后按Ctrl + O来折叠所有实现,以便更容易地操作它们。按Ctrl + M键,然后按Ctrl + P停用大纲。



对于问题的第二部分,请按Ctrl + K,然后按Ctrl + F自动格式化突出显示的代码。按Ctrl + K,然后按Ctrl + D自动格式化整个文档。格式化规则在工具 - >选项...->文本编辑器 - > C / C ++中控制。

其他有用的快捷键可以在Edit-> Advanced或编辑 - >大纲。


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?

解决方案

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.

这篇关于在.cpp文件中命令函数以匹配Visual Studio 2015中的.h文件中的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆