条件式内で auto_gcroot を使用するための演算子。
bool operator!() const;
戻り値
ラップされたオブジェクトが無効な場合は true、それ以外の場合は false です。
使用例
// msl_auto_gcroot_operator_not.cpp
// compile with: /clr
#include <msclr\auto_gcroot.h>
using namespace System;
using namespace msclr;
int main() {
auto_gcroot<String^> s;
if ( s ) Console::WriteLine( "s is valid" );
if ( !s ) Console::WriteLine( "s is invalid" );
s = "something";
if ( s ) Console::WriteLine( "now s is valid" );
if ( !s ) Console::WriteLine( "now s is invalid" );
s.reset();
if ( s ) Console::WriteLine( "now s is valid" );
if ( !s ) Console::WriteLine( "now s is invalid" );
}
s is invalid
now s is valid
now s is invalid
必要条件
ヘッダー ファイル <msclr\auto_gcroot.h>
名前空間 msclr