Equivalent of #region for C++
The Region keyword is IDE specific and affects rendering in Visual Studio. The nearest equivalent is #pragma Region which is applicable to Visual Studio only .
Code example from MSDN
// pragma_directives_region.cpp
#pragma region Region_1
void Test() {}
void Test2() {}
void Test3() {}
#pragma endregion Region_1
int main() {}
In addition to #pragma region
…#pragma endregion
for Visual Studio, many IDEs support the following syntax for regions in any {}
-delimited, //
-commented language:
//{ Region header text.
…
//}
Notable examples include Code::Blocks and FlashDevelop, and any other editor that uses the Scintilla editing component, such as Notepad++, Geany, Komodo Edit, and many more.
There isn't an equivalent in C++. However IDEs should be able to collapse sections.
It is also possible to use something like this:
#pragma region
#pragma endregion A comment about the region.
But probably not very portable