Nugget
|
#include <fixed_pool.h>
Static Public Member Functions | |
static void | swap (Container &a, Container &b) |
fixed_swap
This function implements a swap suitable for fixed containers. This is an issue because the size of fixed containers can be very large, due to their having the container buffer within themselves. Note that we are referring to sizeof(container) and not the total sum of memory allocated by the container from the heap.
This implementation switches at compile time whether or not the temporary is allocated on the stack or the heap as some compilers will allocate the (large) stack frame regardless of which code path is picked.