#include <pool.h>
Public Member Functions | |
| pool (int size) | |
Create a pool of size size. | |
| T * | take () |
| Take an item from the pool. | |
| void | drop (T *p) |
| Release an item back into the pool. | |
| size_t | size () |
| Get the number of (remaining) items in the pool. | |
Definition at line 15 of file pool.h.
| commons::pool< T >::pool | ( | int | size | ) | [inline] |
| T* commons::pool< T >::take | ( | ) | [inline] |
| void commons::pool< T >::drop | ( | T * | p | ) | [inline] |
Release an item back into the pool.
This doesn't check that the pointer being released was one that was originally taken from this pool.
| [in] | p | The pointer to release. |
| exception | The pool is full. |
Definition at line 44 of file pool.h.
00044 { 00045 check(ps.size() < ps.max_size(), "dropping into full pool"); 00046 ps.push_back(p); 00047 }
1.5.6