【问题标题】:no uniquely matching class member found for a template instanciation没有为模板实例化找到唯一匹配的类成员
【发布时间】:2018-11-14 17:07:06
【问题描述】:

我有一个带有模板函数的类。该函数是专门化/实例化的,因此可以在 cpp.xml 中定义。 Doxygen 给我一个关于模板实例化的错误。

例如,我的 .h:

namespace LP
{
    namespace LF
    {
        class FileReader
        {
        public:
            template <class T> void Read( T *aValue );
            size_t Read( uint8_t *aBuffer, size_t aSizeToRead );
        };
    }
}

还有我的 cpp:

/// Valid doxygen function doc
template<class T>
void
LP::LF::FileReader::Read( T *aValue )
{
    Read( reinterpret_cast<uint8_t *>( aValue ), sizeof( T ) );
}

//Template specialisation so it can be defined in the cpp file
template void LP::LF::FileReader::Read<uint8_t>( uint8_t * );
template void LP::LF::FileReader::Read<uint16_t>( uint16_t * );
template void LP::LF::FileReader::Read<uint32_t>( uint32_t * );

我在所有 3 行专业化中都遇到了这个错误:

warning: no uniquely matching class member found for 
  template void LP::LF::FileReader::Read< uint8_t >(uint8_t *)
Possible candidates:
  'template < T >
  void LP::LF::FileReader::Read(T *aValue)' at line 48 of file FileReader.h
  size_t LP::LF::FileReader::Read(uint8_t *aBuffer, size_t aSizeToRead)' at line 49 of file FileReader.h

如果我重命名读取函数之一,它会修复错误,但我不想这样做。

专业化不需要记录,通用功能已经记录在案

doxygen 1.8.13

谢谢

编辑:将标题从专业化更改为实例化

【问题讨论】:

    标签: c++ doxygen


    【解决方案1】:

    没有找到正确的语法,但有一种解决方法:

    /// \relates LP::LF::FileReader
    template void LP::LF::FileReader::Read<uint8_t>( uint8_t * );
    

    不知道为什么,但它会使警告静音

    【讨论】:

      猜你喜欢
      • 2011-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多