小さな標準ヘッダー ファイルに出会いました<new>
。おそらくこれまでに直接使用したことはありません。興味のある方はg++版をどうぞ。
以下の部分は私の興味です:
struct nothrow_t { };
extern const nothrow_t nothrow;
/** If you write your own error handler to be called by @c new, it must
* be of this type. */
typedef void (*new_handler)();
/// Takes a replacement handler as the argument, returns the previous handler.
new_handler set_new_handler(new_handler) throw();
- プログラマはどのよう
struct nothrow_t
にオブジェクトnothrow
を使用しますか? オブジェクトは本当に必要extern
ですか? - はいつ
new_handler
使用されますか? - すべてがblock
operator new/delete
で宣言されているのはなぜですか?extern C++