c++ - could not deduce template argument for 'T' -
my code :
std::vector<double> vec; template<typename t> void getobj(variant &vtprop) { ccomsafearray<t> safearray; safearray.attach(vtprop.parray); ulong count = safearray.getcount(); vec.resize(count); for(ulong index = 0; index < count; index++) { vec[index] = safearray[index]; } }
while compilation got error below:
error c2783: 'void __cdecl getobj(struct tagvariant &)' : not deduce template argument 't'
kindly suggest me correct answer
there nothing in function template's signature allows compiler deduce template type, need explicit:
getobj<theactualtype>(arg);
Comments
Post a Comment