尝试使用时出现以下错误:
typedef QSharedPointer<Test> CTest
CTest* Module::function(params)
{
CTestNew* ptr = new CTestNew(params);
dosomething();
return ptr;
}
然后在代码中用 CTest 替换 Test*。我错过了什么?
error C2664: 'QSharedPointer<T>::QSharedPointer(const QSharedPointer<T> &)' : cannot convert parameter 1 from 'CTestNew*' to 'const QSharedPointer<T> &'
with
[
T=Test
]
Reason: cannot convert from 'CTestNew *' to 'const QSharedPointer<T>'
with
[
T=Test
]
Constructor for class 'QSharedPointer<T>' is declared 'explicit'
with
[
T=Test
]