簡體   English   中英

使用 gcc 11.2.0 的模板 class 構造函數錯誤

[英]template class constructor error using gcc 11.2.0

template <class T>
class UserdataValue : public Userdata {
 private:
  UserdataValue<T>(UserdataValue<T> const&);
  UserdataValue<T> operator=(UserdataValue<T> const&);
};

使用gcc11.2.0編譯時,報錯:[在此處輸入圖片描述][1]

/home/user00/hxnextSvr2/dep/luabridge/detail/Userdata.h:247:36: 錯誤:預期 ')' 在 'const' 247 | 用戶數據值(用戶數據值常量&); | ~ ^~~~~~ | ) [1]: https://i.stack.imgur.com/LhFbC.png

您不應在復制構造函數上設置 teplate 參數

因此:

template <class T>
class UserdataValue : public Userdata {
 private:
  UserdataValue(UserdataValue<T> const&); // no template specification here
  UserdataValue<T> operator=(UserdataValue<T> const&);
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM