This union defines the storage area for a functor representation. The design uses the small‐object optimization in an attempt to avoid allocations for objects that are no larger than InplaceBuffer. When the target object is no larger than InplaceBuffer, the small‐object optimization can be used by storing the target directly within the InplaceBuffer.
Synopsis
Declared in <bslstl_function_smallobjectoptimization.h>
union InplaceBuffer;
Description
Note that union members other than d_object_p are just fillers to make sure that a function or member function pointer can fit without allocation, and that InplaceBuffer has maximum alignment. The d_minbuf member ensures that InplaceBuffer is large enough to hold modestly complex functors, like bdlf::Bind objects and other functors that store embedded arguments, eliminating the need to allocate memory from the heap for the footprint of such objects.
The size of this type ensures that the inplace buffer will be 6 pointers in size, and the total footprint of a bsl::function object on most platforms will be 10 pointers, which matches the sizes of previous implementations of bdef_Function.
Data Members
Name |
Description |
|
Force alignment of the inplace buffer. |
|
Pointer to a function stored in the inplace buffer. |
|
Pointer to member data stored in the inplace buffer. |
|
Pointer to a member function stored in the inplace buffer. |
|
Minimum buffer size for the inplace representation. |
|
Pointer to an external representation stored out of line. |
Created with MrDocs