pointers_to_members
C++ Specific
Specifies whether a pointer to a class member can be declared before its associated class definition and is used to control the pointer size and the code required to interpret the pointer.
#pragma pointers_to_members( pointer-declaration, [most-general-representation] )
Remarks
You can place a pointers_to_members pragma in your source file as an alternative to using the /vmx compiler options or the inheritance keywords.
The pointer-declaration argument specifies whether you have declared a pointer to a member before or after the associated function definition. The pointer-declaration argument is one of the following two symbols:
Argument |
Comments |
---|---|
full_generality |
Generates safe, sometimes nonoptimal code. You use full_generality if any pointer to a member is declared before the associated class definition. This argument always uses the pointer representation specified by the most-general-representation argument. Equivalent to /vmg. |
best_case |
Generates safe, optimal code using best-case representation for all pointers to members. Requires defining the class before declaring a pointer to a member of the class. The default is best_case. |
The most-general-representation argument specifies the smallest pointer representation that the compiler can safely use to reference any pointer to a member of a class in a translation unit. The argument can be one of the following:
Argument |
Comments |
---|---|
single_inheritance |
The most general representation is single-inheritance, pointer to a member function. Causes an error if the inheritance model of a class definition for which a pointer to a member is declared is ever either multiple or virtual. |
multiple_inheritance |
The most general representation is multiple-inheritance, pointer to a member function. Causes an error if the inheritance model of a class definition for which a pointer to a member is declared is virtual. |
virtual_inheritance |
The most general representation is virtual-inheritance, pointer to a member function. Never causes an error. This is the default argument when #pragma pointers_to_members(full_generality) is used. |
Example
// Specify single-inheritance only
#pragma pointers_to_members( full_generality, single_inheritance )