共用方式為


The __if_not_exists Statement 

__if_not_exists allows you to conditionally include code depending on whether the specified symbol does not exist.

__if_not_exist ( variable ) { 
statements 
}

where:

  • variable
    The symbol whose existence you want to test for.
  • statements
    One or more statements to execute if variable does not exists.

Remarks

__if_not_exists can be applied to identifiers both inside of and outside of a class. When testing for overload functions, you cannot test for a specific form of the overload.

__if_not_exists should only be used within the body of a function. Outside of the body of a function __if_not_exists can only refer to fully defined types.

__if_exists allows you to conditionally include code depending on whether the specified symbol exists.

Example

See __if_exists for an example of how to use __if_not_exists.

See Also

Reference

Selection Statements (C++)
C++ Keywords