|
Boost Users : |
From: Adam Peterson (adamw_at_[hidden])
Date: 2004-12-30 14:46:50
Essentially, I'm passing a function a scoped_array and I want to assign data
to it. It seems like there isn't a way to copy a chunk of data to the
scoped_array except when it is created. Functionaly I'm where I want to be,
but I'm thinking I must be misunderstanding the correct way to do this. I'm
getting the data from a DLL that allocates its own memory, so I have to copy
the data locally, then call the DLL's function to release the memory. Is
this the best way to accomplish what I'm after?
Thanks,
Adam
This is currently how I'm doing it:
function blah(...., scoped_array<APPRIGHTITEM>& saGroups )
{
LPAPPRIGHTITEM lpAppRightItemList = NULL;
get_my_data( &lpAppRightItemList, &dwCount );
LPAPPRIGHTITEM sap = (LPAPPRIGHTITEM) new APPRIGHTITEM [ dwRightCount ];
memcpy(sap, lpAppRightItemList, sizeof(APPRIGHTITEM) * dwRightCount);
scoped_array<APPRIGHTITEM> saTemp ( sap );
saGroups.swap( saTemp );
FreeList( lpAppRightItemList );
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net