c++ - auto_ptr for arrays -


In short, I'm wondering if there is a type of auto_ptr for an orange, I know that I do my own roll I am just making sure that there is nothing already.

I know about vectors even though I do not think I can use them. I am using several Windows API / SDK like Windows Media SDK, DirectShow API, so that some structures can be moved back to the function call, which takes an indicator and size twice. The first time I have to allocate to get that data, for which I am looking for, the first time to pass as an indicator to return the shape of the structure. For example:

  CComQIPtr & lt; IWMMediaProps & gt; PProps (m_pStreamConfig); DWORD cbType = 0; WM_MEDIA_TYPE * pType = NULL; Hr = pProps-> GetMediaType (NULL, & amp; cbType); CHECK_HR (hour); PTEP = (WM_MDIITYE *) New BYTE [cbType]; // auto_ptr instread hr = pProps-> GetMediaType (Ptytype, & amp; cbType); CHECK_HR (hour); // ... remove some stuff [] petite; Since the CB type usually returns to (WM_MEDIA_TYPE) is actually larger than the fact that there is an indicator of any other structure, I just do not assign items to WM_MEDIA_TYPE Is there anything like that?   

Use

  std:: vector & lt; Byte & gt; Buffer (cbType); PType = (WM_MEDIA_TYPE *) and buffer [0];  

or C ++ 11

  std :: vector & lt; BYTE & gt; Buffer (cbType); PType = (WM_MEDIA_TYPE *) buffer data ();  

Instead


Extra: If someone is asking what answer is Yes after the C ++ 03 standard


if by your compiler If C ++ 11 is supported, unique_PTR can be used for arrays.

  unique_ptr> LT; Byte [] & gt; Buffer (new BYTE [cbType]); PType = (WM_MEDIA_TYPE *) buffer.get ();  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -