结构要求? [英] structure required?
本文介绍了结构要求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用一个指向Job类对象的指针向量(作业类是我定义的一个)
当我游戏中的某个人死亡时,指向他曾经拥有的作业的指针被添加一个矢量来跟踪没有劳动力的工作。
无论如何当我尝试使用这些工作时他们不工作
这就是我试过的:
i am working with a vector of pointers to Job class objects(job class is one that i defined)
when a person in my game dies, a pointer to the job he once had is added to a vector to track jobs that have no labor.
anyway when i try to use these they dont work
this is what i tried:
展开 | 选择 | Wrap | 行号
推荐答案
i我正在使用指向Job类对象的指针向量(作业类是我定义的一个ed)
当我的游戏中的人死亡时,指向他曾经拥有的工作的指针被添加到矢量中以跟踪没有劳动力的工作。
无论如何,当我尝试使用它们时,它们不工作
这是我尝试的:
i am working with a vector of pointers to Job class objects(job class is one that i defined)
when a person in my game dies, a pointer to the job he once had is added to a vector to track jobs that have no labor.
anyway when i try to use these they dont work
this is what i tried:
展开 | 选择 | Wrap | 行号
现在我将代码修改为两种方式并获得相同的异常:
这次在运行时
:
---------------------------
调试器异常通知
- -------------------------
P roject Project1.exe引发了异常类std :: bad_alloc,消息为''异常对象地址:0xF5BA42''。流程停止了。使用步骤或运行继续。
---------------------------
OK Help
---------------------------
now i fixed the code to both of the two ways and got the same exception:
this time at runtime:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class std::bad_alloc with message ''Exception Object Address: 0xF5BA42''. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
显然你正在使用没有try / catch块的new运算符。
bad_alloc通常意味着你的堆内存不足。
试一试/ catch应该允许您查看异常被抛出的位置。
Apparently you are using the new operator without try/catch blocks.
A bad_alloc usually means you have run out of heap memory.
A try/catch should allow you to see where the exception is being thrown.
这篇关于结构要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文