Why &(ComPtr.Get()) != ComPtr.GetAddressOf()?
I tryed to pass ID3D11ShaderResourcesView* to function and convert it to ** to use in CreateShaderResourceView, but it didnt work correct.
I realized, that the problem in 3 argument.
You are taking the address of the pointer that ComPtr.Get()
returns. That's entirely different to the pointer to the object.
ComPtr.Get()
returns the held pointer by value , so &(ComPtr.Get())
is taking the address of a copy of the held pointer.
ComPtr.GetAddressOf()
returns the address of the held pointer itself, not a copy of it.
Had ComPtr.Get()
returned the held pointer by reference instead then &(ComPtr.Get())
would take the address of the original pointer, not a copy. But it does not return a reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.