gpt4 book ai didi

c++ - 我如何记录以便文档适用于类成员而不是匿名类型?

转载 作者:行者123 更新时间:2023-11-30 02:28:09 24 4
gpt4 key购买 nike

考虑以下示例。

/// \addtogroup api Foo Group
/// @{

/**
* This class is well-documented.
*/
struct ThreadContext {
/// Storage for the ThreadInvocation object that contains the function and
/// arguments for a new thread.
struct alignas(CACHE_LINE_SIZE) {
/// This data is glorious.
char data[CACHE_LINE_SIZE];
} threadInvocation;
};
/// @}

当我对此运行 doxygen 时,我收到以下警告。

Doxygen/Main.h:13: warning: Member threadInvocation (variable) of class ThreadContext is not documented.

Storage for the ... 开头的注释应该是指threadInvocation 对象,但doxygen 认为它指的是匿名结构 代替。

我如何告诉 doxygen 我希望文档引用 threadInvocation 成员?

最佳答案

在挖掘 doxygen documentation 之后此外,我发现 doxygen 实际上允许在几乎任何地方记录大多数代码。为了记录 threadInvocation 并避免关于未记录匿名 struct 的警告,我不得不这样编写我的代码。

/// \addtogroup api Foo Group
/// @{

/**
* This class is well-documented.
*/
struct ThreadContext {
/// \var threadInvocation
/// Storage for the ThreadInvocation object that contains the function and
/// arguments for a new thread.

/// \cond SuppressDoxygen
struct alignas(CACHE_LINE_SIZE) {
/// This data is glorious.
char data[CACHE_LINE_SIZE];
}
/// \endcond
threadInvocation;
};
/// @}

关于c++ - 我如何记录以便文档适用于类成员而不是匿名类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41070972/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com