Hello.
I have a shared_ptr boost and I have to send to a library a function a pointer to a pointer:
for a raw pointer eg
type * pPointer
functionx void (** pPointerSend ppPointer)
for call it: functionx (& pPointer);
but with the boost::shared_ptr?
boost:: shared_ptr <type> t (new type ());
.
.
void f (type ** ppType);
I tried to get:
f (& t.get ())
but it gives me this error Error 7 error C2102: '&' Requires l-value c: \ PGN \ trunk \ PGEApplication \ WindowApplication.cpp 86
thanks.
[Edited by - giugio on December 24, 2010 6:48:42 AM]
shared pointr boost and **pPointer
This can't be done directly with a boost::shared_ptr. The correct way to do this depends on what the function you're calling actually does.
this is the directx 11 function and the m_ptrSwapChain is the boost shared_ptr(i use a typedef):
hr = D3D11CreateDeviceAndSwapChain( NULL, m_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
D3D11_SDK_VERSION, &sd, &*m_ptrSwapChain.get(), &m_ptrDevice, &m_featureLevel, &m_ptrDeviceContext );
hr = D3D11CreateDeviceAndSwapChain( NULL, m_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
D3D11_SDK_VERSION, &sd, &*m_ptrSwapChain.get(), &m_ptrDevice, &m_featureLevel, &m_ptrDeviceContext );
In this case a better solution is to not use a boost::shared_ptr and use a CComPtr, which is designed for use with COM objects including DirectX objects.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement