[英]Return value type does not match the function type despite it working in many other points in the header
正如標題所讀。 我使用包含的方法 function 有許多其他功能,只是似乎不喜歡這個。
任何幫助表示贊賞。
也請原諒我可能不正確的術語。 我很害怕。
錯誤
unsigned long Create_Font() noexcept
{
using Create_Font = void(__thiscall*)(void*);
return method<Create_Font>(66, this)(this);
}
方法 Function
template<typename out,class type>
inline out method(size_t index, type* self) noexcept
{
return reinterpret_cast<out>((*reinterpret_cast<void***>(self))[index]);
}
您的Create_Font
類型被聲明為返回void
:
using Create_Font = void(__thiscall*)(void*);
// ^-- returns void
但是您的Create_Font
function 被定義為返回unsigned long
:
unsigned long Create_Font() noexcept {
// ^-- returns unsigned long
/* ... */
}
所以你的編譯器會抱怨return method<Create_Font>(66, this)(this);
,因為method<Create_Font>(66, this)(this)
的結果是void,但是function需要返回一個unsigned long
。
(並且沒有明智的方法可以將 void “轉換”為 unsigned long)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.