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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With