auto_gcroot::operator!

条件式で 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" );
}
  

必要条件

ヘッダー ファイル <msclr \ auto_gcroot.h>

名前空間 の msclr

参照

関連項目

auto_gcroot::operator bool

その他の技術情報

auto_gcroot Members