Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
VS2008以降、クラスbad_allocは、文字列パラメーターを持つコンストラクターを提供していません。このようにクラスを上書きせずにカスタムメッセージを作成する可能性はありますか?
// this is only pseudo-code class custom_exception : bad_alloc { public: string Message; custom_exception(string m) {Message = m;} }
bad_allocメモリを割り当てずに構築可能である必要があります。そのため、コンストラクタはメッセージパラメータを取りません。もちろん、それをサブクラス化してオーバーライドすることもできますwhat。
bad_alloc
what