Describe the feature you'd like
Add a monadic interface for handling obtaining objects from a pool
Additional context
Currently when a pool is empty - no items available - it's up to the user to write all the code and conditions to deal with that case.
Retrieving an object from the pool can also be a little expensive since it needs to be wrapped in a PoolItem object.
I propose an interface that would allow users to pass a lambda for each situation - item acquired or not (pool empty), something like
auto pool = dxpool::StaticPool<ItemType, 1>();
auto itemPresentLambda = [](ItemType& item){...};
auto poolEmptyLambda = [](){...};
pool
.Get(itemPresentLambda).
.OrElse(poolEmptyLambda();
Describe the feature you'd like
Add a monadic interface for handling obtaining objects from a pool
Additional context
Currently when a pool is empty - no items available - it's up to the user to write all the code and conditions to deal with that case.
Retrieving an object from the pool can also be a little expensive since it needs to be wrapped in a
PoolItemobject.I propose an interface that would allow users to pass a lambda for each situation - item acquired or not (pool empty), something like