Poznámka:
Přístup k této stránce vyžaduje autorizaci. Můžete se zkusit přihlásit nebo změnit adresáře.
Přístup k této stránce vyžaduje autorizaci. Můžete zkusit změnit adresáře.
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at auto_gcroot::operator!.
Operator for using auto_gcroot in a conditional expression.
Syntax
bool operator!() const;
Return Value
true if the wrapped object is invalid; false otherwise.
Example
// 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
Requirements
Header file <msclr\auto_gcroot.h>
Namespace msclr