RAII wrapper for managing leased ObjectPool objects.
More...
#include <ObjectPool.hpp>
|
| | PoolLease (Pool &p) |
| | Creates a PoolLease and acquires an object from the given pool.
|
| |
| | PoolLease (PoolLease &&o) noexcept |
| | Move constructor for PoolLease. Transfers ownership and deactivates the source to prevent double release.
|
| |
|
| PoolLease (const PoolLease &)=delete |
| |
|
PoolLease & | operator= (const PoolLease &)=delete |
| |
|
| ~PoolLease () |
| | Destructor for the PoolLease class.
|
| |
| auto & | get () noexcept |
| | Returns a reference to the internal object.
|
| |
| value_type * | operator-> () noexcept |
| | Provides pointer-like access to the underlying object.
|
| |
| const auto & | get () const noexcept |
| | Returns a constant reference to the managed object.
|
| |
| const value_type * | operator-> () const noexcept |
| | Provides pointer-like access to the underlying object.
|
| |
| value_type | release () noexcept |
| | Releases ownership of the managed object.
|
| |
template<typename Pool>
class intns::memory::PoolLease< Pool >
RAII wrapper for managing leased ObjectPool objects.
PoolLease acquires an ObjectPool object on creation and releases it on destruction unless explicitly released; guarantees exception safety and prevents leaks.
- Template Parameters
-
| Pool | The ObjectPool providing value_type, take(), and add() methods. |
◆ PoolLease() [1/2]
Creates a PoolLease and acquires an object from the given pool.
- Parameters
-
| p | Reference to the Pool to lease from. |
◆ PoolLease() [2/2]
Move constructor for PoolLease. Transfers ownership and deactivates the source to prevent double release.
- Parameters
-
◆ get() [1/2]
Returns a constant reference to the managed object.
- Returns
- const reference to the object stored in the pool.
◆ get() [2/2]
Returns a reference to the internal object.
- Returns
- Reference to the stored object.
◆ operator->() [1/2]
Provides pointer-like access to the underlying object.
- Returns
- A constant pointer to the managed object.
◆ operator->() [2/2]
Provides pointer-like access to the underlying object.
- Returns
- A pointer to the managed object.
◆ release()
Releases ownership of the managed object.
Marks the object inactive and returns it, transferring ownership; it is no longer considered active.
- Returns
- value_type The managed object, moved out of this instance.
- Note
- This function is noexcept and guarantees not to throw exceptions.
The documentation for this class was generated from the following file: