我写了一个小级,以协助转换和从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