我正在编写一个异步库,我的一些方法将回调作为参数:
/// \brief Opens a connection to the remote server defined by the parameters passed in the constructor.
/// \param[in] callback Callback passed when the connection is estabelished or fails.
/// \return Any errors encountered by the library or the OS.
virtual connect(std::function<void(std::error_code ec)> callback) noexcept = 0;
如何在 Doxygen 中记录回调的参数?
最佳答案
您想要一种以嵌套方式(函数参数内的函数)记录仿函数本身的方法,但 Doxygen 不支持该 AFAIK。您可以使用 \parblock
手动完成还有一些Doxygen Markdown .另一种手动方法是将回调定义移动到 typedef
并用 \typedef
记录它。 ,这将再次需要手动操作,因为 Doxygen 不以这种方式支持仿函数。
关于c++ - 如何记录接受回调的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54483956/