Documentation of memory
Manually takes care of the lifetime of the per-thread temporary_stack.
The constructor will create it, if not already done, and the destructor will destroy it, if not already done.
- If there are multiple objects in a thread, this will lead to unnecessary construction and destruction of the stack. It is thus adviced to create one object on the top-level function of the thread, e.g. in
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE == 2, it is not necessary to use this class, the nifty counter will clean everything upon program termination. But it can still be used as an optimization if you have a thread that is terminated long before program exit. The automatic clean up will only occur much later.
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE == 0, the use of this class has no effect, because the per-thread stack is disabled.
|static constexpr std::size_t||default_stack_size|
|static const struct foonathan::memory::temporary_stack_initializer::defer_create_t||defer_create|
|temporary_stack_initializer (defer_create_t) noexcept|
|temporary_stack_initializer (std::size_t initial_size=default_stack_size)|
|~temporary_stack_initializer () noexcept|
|temporary_stack_initializer (temporary_stack_initializer &&)=delete|
|temporary_stack_initializer &||operator= (temporary_stack_initializer &&)=delete|
- Does not create the per-thread stack. It will be created by the first call to get_temporary_stack() in the current thread.
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE == 0, this function has no effect.
|temporary_stack_initializer||(||std::size_t||initial_size = ||)|
- Creates the per-thread stack with the given default size if it wasn't already created.
initial_sizemust not be
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE != 0.
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE == 0, this function will issue a warning in debug mode. This can be disabled by passing
0as the initial size.
- Destroys the per-thread stack if it isn't already destroyed.
Generated by 1.8.12