mardi 12 février 2019

Object pool that returns objects to pool when destroyed (pt2)

This is a continuation from this post. I'm trying to more or less do the same without custom deleters but am not sure how to proceed.

I have an object pool and an object connection, where pool is a connection pool.

Connections are made up of a pure virtual interface and a class that implements usage and are meant to be used through std::unique_ptr. Each connection also has a reference to the pool.

So my question is: can I have an object move itself? In the destructor of the connection can I have it move to the std::vector in the pool, through the reference?

Aucun commentaire:

Enregistrer un commentaire