作者lovejomi (JOMI)
看板C_and_CPP
標題[問題] CRTP 如何寫return type?
時間Wed Nov 7 00:56:44 2018
這標題有點難下...
目前使用C++11 我有需求想寫CRTP 的寫法
發現我有個盲點
https://ideone.com/A480at
我發現我根本對於 derived class的function return type無法掌握
C++14直接寫auto真的不用想太多
但是若在C++11 或更早的C++ 是不是做不到?
C++11試圖寫 -> decltype(????) 裡面不知道怎麼寫
C++98 是完全不知道怎麼寫?
請教一下
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.26.160.166
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1541523408.A.896.html
→ notBeing: 用 typedef 不行嗎? 11/07 01:46
→ ibmibmibm: std::result_of,或是decltype(...) 11/08 00:35
→ ibmibmibm: -> decltype(static_cast<T*>(this)->VirtualFuncImpl) 11/08 00:35
→ PkmX: 樓上的編譯不會過吧... 11/08 21:42