'identifier': メンバー以外の演算子 new
または delete
関数は、 static
またはグローバル名前空間以外の名前空間で宣言することはできません。
new
およびdelete
オーバーロード演算子は、非静的であり、グローバル名前空間またはクラス メンバーとして定義されている必要があります。
次の例では C2323 が生成されます。
// C2323.cpp
// compile with: /c
static void* operator new(size_t); // C2323 since static
static void operator delete(void*); // C2323 since static
namespace NS
{
void* operator new(size_t); // C2323 since not defined in the global namespace
void operator delete(void*); // C2323 since not defined in the global namespace
}