MongoDB C++ Driver
legacy-1.1.2
|
The StackBufBuilder builds smaller datasets on the stack instead of using malloc. More...
#include <builder.h>
Additional Inherited Members | |
Public Member Functions inherited from mongo::_BufBuilder< StackAllocator > | |
char * | skip (int n) |
leave room for some stuff later More... | |
int | len () const |
int | getSize () const |
void | reserveBytes (int bytes) |
Reserve room for some number of bytes to be claimed at a later time. | |
void | claimReservedBytes (int bytes) |
Claim an earlier reservation of some number of bytes. More... | |
The StackBufBuilder builds smaller datasets on the stack instead of using malloc.
this can be significantly faster for small bufs. However, you can not decouple() the buffer with StackBufBuilder. While designed to be a variable on the stack, if you were to dynamically allocate one, nothing bad would happen. In fact in some circumstances this might make sense, say, embedded in some other object.