ale*_*555 3 c++ bad-alloc
由于 VS2008 类 bad_alloc 不提供带有字符串参数的构造函数。有没有可能在不覆盖这样的类的情况下创建自定义消息?
// this is only pseudo-code class custom_exception : bad_alloc { public: string Message; custom_exception(string m) {Message = m;} }
eca*_*mur 5
bad_alloc需要在不分配内存的情况下进行构造,这就是为什么它的构造函数不接受消息参数的原因。您当然可以将其子类化并覆盖what.
bad_alloc
what
归档时间:
13 年,4 月 前
查看次数:
1559 次
最近记录: