【问题标题】:What is @ in C++ and why it is used in C++ header files?C++ 中的 @ 是什么以及为什么在 C++ 头文件中使用它?
【发布时间】:2021-10-28 15:19:18
【问题描述】:

我查看了C++queue头文件,发现了一段代码。

队列头文件中的一段代码

#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;
    }

什么是@ 以及为什么在多行 cmets 中使用它。 @ 之后的文本也在我的 IDE 中突出显示(在 @defgroup 中),这是什么意思?

我在网上搜索了同样的结果,但没有找到令人满意的结果,结果显示operators in C++之类的东西。

【问题讨论】:

  • @ 在 cmets 中,而不是 c++ 的一部分。
  • 这可能是一个 Doxygen 评论。

标签: c++ operators comments header-files


【解决方案1】:

@ 不是 C++ 语言的一部分。 cmets 中可以使用任何字符。评论可以具有可由第 3 方处理器处理的标记。在这种情况下,@ 最有可能是 Doxygen。以下是上述 cmets 中的标记示例:Heap [Sorting]

cmets 中的另一个标记示例是XML Documentation in Visual C++

【讨论】:

    猜你喜欢
    • 2011-06-18
    • 1970-01-01
    • 2015-07-04
    • 2011-12-31
    • 2017-01-21
    • 2017-02-11
    • 2017-10-01
    • 2012-09-12
    相关资源
    最近更新 更多