我寫了一個小級,以協助轉換和從MSVC的笨重類型:這個簡單的模板類有什麼問題嗎?
template <class FromType>
struct convert
{
convert(FromType const &from)
: from_(from) {}
operator LARGE_INTEGER() {
LARGE_INTEGER li;
li.QuadPart = from_;
return li;
}
private:
FromType const &from_;
};
後來我這樣做:
convert(0)
,並從MSVC此錯誤消息:
1> e:\ src \ cpfs \ libcpfs \ device.cc(41):error C2955:'convert':使用類模板需要模板參數列表
1> E:\ SRC \ CPFS \ libcpfs \ device.cc(17):看 '轉換'
我認爲FromType
可以從我傳遞的整數推斷的聲明?到底是怎麼回事?
U需要做這樣的轉換(0) –
vinothkr
2010-11-15 05:30:17