看板 C_and_CPP 關於我們 聯絡資訊
這標題有點難下... 目前使用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
PkmX: https://wandbox.org/permlink/YeHhtbGpRscoBA8m C++11解法 11/08 21:43