Reputation: 4359
I just got started with DirectX 11.1 for Windows 8 apps and I got the following ComPtr for example:
ComPtr<ID3D11Buffer> constantBuffer;
What I wonder is, what is the difference between using &constantBuffer
and constantBuffer.GetAddressOf()
?
Sometimes they both works fine, but sometimes using &constantBuffer
will cause my program to crash with an access violation.
Upvotes: 6
Views: 2903
Reputation: 16168
Did you read documentation?
GetAddressOf - Retrieves the address of the ptr_ data member, which contains a pointer to the interface represented by this ComPtr.
Operator& - Releases the interface associated with this ComPtr object and then retrieves the address of the ComPtr object.
Upvotes: 7