我想實現一個表達式類2算術類型的專業化。這是默認的類:模板專門化與enable_if和is_arithmetic一類
template<typename Left, typename Op, typename Right, typename std::enable_if<!std::is_arithmetic<Left>::value, Left>::type* = nullptr>
class Expression { /* ... */ }
而這些都是兩個專業:
template<typename Left, typename Op, typename Right, typename std::enable_if<std::is_arithmetic<Left>::value, Left>::type* = nullptr>
class Expression { /* ... */ };
template<typename Left, typename Op, typename Right, typename std::enable_if<std::is_arithmetic<Right>::value, Right>::type* = nullptr>
class Expression { /* ... */ };
如果我現在編譯我的代碼,我得到這個錯誤:
Error C3855 'Expression': template parameter '__formal' is incompatible with the declaration Vector
我怎樣才能解決我的模板和專業化或虛擬類型的問題,因爲我用它們。
請分享顯示相同錯誤的最小代碼示例。有了你提供的信息,很難猜到,出了什麼問題。 – paweldac
在示例代碼中的任何地方我都沒有看到名爲'__formal'的模板參數(這是一個保留的標識符)或名爲'Vector'的聲明。請發佈[mcve]。 – Praetorian