__if_not_exists Statement
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 __if_not_exists Statement.
The __if_not_exists statement tests whether the specified identifier exists. If the identifier does not exist, the specified statement block is executed.
__if_not_exists ( identifier ) {
statements
};
Parameters
| Parameter | Description |
|---|---|
identifier | The identifier whose existence you want to test. |
statements | One or more statements to execute if identifier does not exist. |
To achieve the most reliable results, use the |
Apply the
__if_not_existsstatement to only simple types, not templates.Apply the
__if_not_existsstatement to identifiers both inside or outside a class. Do not apply the__if_not_existsstatement to local variables.Use the
__if_not_existsstatement only in the body of a function. Outside of the body of a function, the__if_not_existsstatement can test only fully defined types.When you test for overloaded functions, you cannot test for a specific form of the overload.
The complement to the __if_not_exists statement is the __if_exists statement.
For an example about how to use __if_not_exists, see __if_exists Statement.