xcode #pragma 标记在 Visual Studio for C++ 中等效?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15360229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:57:07  来源:igfitidea点击:

#pragma mark equivalent in Visual Studio for C++?

c++xcodevisual-studio-2010pragma

提问by KillAWatt1705

Is there a Visual Studio preprocessor equivalent of #pragma markfound in XCode? Here's why I ask:

#pragma mark在 XCode 中是否有等效的 Visual Studio 预处理器?这就是我问的原因:

This is on Windows.

这是在 Windows 上。

enter image description here

在此处输入图片说明

This is on Mac.

这是在 Mac 上。

enter image description here

在此处输入图片说明

I know of #regionin C#, but nothing of similar functionality in C++.

我知道#region在 C# 中,但在 C++ 中没有类似的功能。

EDIT 12/03/2013:

编辑 12/03/2013

#pragma regionadds collapsibility to code, but doesn't add sections to VS's method listings, which is essentially what I'm looking for. I much prefer to jump to methods quickly using the function listing, especially in large classes/files where scrolling through a forest of code is a no-no; the "sectioning" really shines in such cases.

#pragma region为代码添加可折叠性,但不会向 VS 的方法列表添加部分,这基本上是我正在寻找的。我更喜欢使用函数列表快速跳转到方法,特别是在大型类/文件中,滚动代码森林是禁忌;在这种情况下,“切片”真的很受欢迎。

I was really expecting Visual Studio to have this kind of functionality, seems like something pretty basic. Pretty sure Eclipse lets you do this with the Coffee-Bytes plugin too.

我真的很期待 Visual Studio 有这种功能,看起来很基本。可以肯定的是,Eclipse 也允许您使用 Coffee-Bytes 插件来执行此操作。

回答by Shmil The Cat

You can use #pragma region:

您可以使用#pragma region

#pragma region foo
// some code ...
#pragma endregion foo

回答by FrankS101

Apparently, it is not in Visual studio 2015 and I don't think it will be in the near future. [Reference]

显然,它不在 Visual Studio 2015 中,我认为它不会在不久的将来出现。[参考]

Thanks for taking the time to share this suggestion. This item has been around for a couple of versions of Visual Studio and we haven't acted on it. Looking at the VS “15” plans, we're not going to take action on this item, so we're going to close it. If the suggestion is still relevant, please either take a look to see if there's another suggestion that's similar that you can vote on, or open a new suggestion.

感谢您抽出宝贵时间分享此建议。此项目已存在于几个版本的 Visual Studio 中,我们尚未对其采取行动。看看VS“15”计划,我们不会对这个项目采取行动,所以我们将关闭它。如果该建议仍然相关,请查看是否还有其他类似的建议可供您投票,或者提出新建议。