大佬教程收集整理的这篇文章主要介绍了c – auto_ptr无法正常工作 – 编译错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在juanchopanza建议之后,我设法得到了这个最小的例子:
#include <memory> struct a{ int b; }; int main() { typedef std::auto_ptr<a> ArgAutoPtr; ArgAutoPtr floaTingArg; floaTingArg = ArgAutoPtr( new a ); }
这给了我错误:
no match for 'operator=' in 'm_floaTingArg = std::auto_ptr<a>(((a*)operator new(4u)))'
QNX 6.4.1与GCC 4.3.3
编辑
我设法像这样编译它.这是否按预期工作或将生成…无论恶魔auto_ptr生成什么?
ArgAutoPtr floaTingarg2 = ArgAutoPtr( new a ); floaTingArg = floaTingarg2;
auto_ptr :: operator =对其参数采用非const引用,与operator =的每个其他示例不同.非const引用不能绑定到临时引用.
以上是大佬教程为你收集整理的c – auto_ptr无法正常工作 – 编译错误全部内容,希望文章能够帮你解决c – auto_ptr无法正常工作 – 编译错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。