Is there an alternative to using the following?
class IGraphBuilder;
public ref class Device
{
private:
IGraphBuilder* pGraphBuilder;
public:
void Configure()
{
pin_ptr<IGraphBuilder*> ppGraphBuilder = &pGraphBuilder;
HRESULT hr = CoCreateInstance(CLSID_FilterGraph,
NULL,
CLSCTX_INPROC,
IID_IGraphBuilder, (void**)ppGraphBuilder);
reinterpret_cast(ppGraphBuilder) compiles but I'm a bit confused if this is correct for this case.
If this wasn't C++/CLI (where &NativeMember
actually means interior_ptr<Type>(NativeMember)
) I would simply use static_cast<void**>(&pGraphBuilder)
but even after correctly casting to pin_ptr
the following doesn't compile
pin_ptr<IGraphBuilder*> ppGraphBuilder = &pGraphBuilder;
static_cast<void**>(ppGraphBuilder)
Is there any solution or am I forced to use (void**) because pin_ptr is weird?