The compiler is right: although std::unique_ptr<INuiSensor>
can be used to point to things, it is not an object a pointer to which is expected by the NuiCreateSensorByIndex(int,INuiSensor**)
function. The reason the function wants a pointer to a pointer is that it wants to modify pointer's content by an assignment of this sort:
*ptrToPtr = somePtr;
If compiler let you pass a pointer to std::unique_ptr<INuiSensor>
, this assignment would be invalid. That's why you need to create a temporary "naked" pointer, pass it to the function, and then assign the result back to std::unique_ptr<INuiSensor>
.