[#BloombergLP-bslstl-Function_SmallObjectOptimization-InplaceBuffer] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Function_SmallObjectOptimization.adoc[Function_SmallObjectOptimization]::InplaceBuffer :relfileprefix: ../../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_align.adoc[`d_align`] [.small]#[variant member]# | Force alignment of the inplace buffer. | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_func_p.adoc[`d_func_p`] [.small]#[variant member]# | Pointer to a function stored in the inplace buffer. | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_memData_p.adoc[`d_memData_p`] [.small]#[variant member]# | Pointer to member data stored in the inplace buffer. | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_memFunc_p.adoc[`d_memFunc_p`] [.small]#[variant member]# | Pointer to a member function stored in the inplace buffer. | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_minbuf.adoc[`d_minbuf`] [.small]#[variant member]# | Minimum buffer size for the inplace representation. | xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_object_p.adoc[`d_object_p`] [.small]#[variant member]# | Pointer to an external representation stored out of line. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#