mardi 19 mars 2019

Create a unique pointer from raw pointer ensuring that it will be deleted when out of scope

We are using boost Circular queue in our code. I am to write a code that will get a specific type of data from queue else delete from queue if not.

void chkdata()
{
.....
auto rawpacket = buf.front().release();
//auto r = std::make_unique<decltype(buffer.front().release())>(buffer.front().release()); need to implement like this so that auto delete will happen
}

How can I implement the same?

Aucun commentaire:

Enregistrer un commentaire