C++ 中的@ 是什么,为什么在 C++ 头文件中使用它?
我正在查看queue头文件C++并找到了一段代码。
来自队列头文件的一段代码
#include <debug/debug.h>
#include <bits/move.h>
#include <bits/predefined_ops.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @defgroup heap_algorithms Heap
* @ingroup sorting_algorithms
*/
template<typename _RandomAccessIterator, typename _Distance,
typename _Compare>
_GLIBCXX20_CONSTEXPR
_Distance
__is_heap_until(_RandomAccessIterator __first, _Distance __n,
_Compare& __comp)
{
_Distance __parent = 0;
for (_Distance __child = 1; __child < __n; ++__child)
{
if (__comp(__first + __parent, __first + __child))
return __child;
if ((__child & 1) == 0)
++__parent;
}
return __n;
}
@它是什么以及为什么在多行注释中使用它。后面的文本@也在我的 IDE 中突出显示(在 中@defgroup),这是什么意思?
我在网上搜索相同但没有找到令人满意的结果,结果显示operators in C++了一些东西。
回答
@不是 C++ 语言的一部分。注释中可以使用任何字符。评论可以包含可由 3rd 方处理器处理的标记。在这种情况下,@最有可能是Doxygen。以下是上述评论中的标记示例:Heap [Sorting]。
注释中标记的另一个示例是Visual C++ 中的 XML 文档。