[#BloombergLP-bslstl-Function_SmallObjectOptimization-InplaceBuffer]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Function_SmallObjectOptimization.adoc[Function&lowbar;SmallObjectOptimization]::InplaceBuffer
:relfileprefix: ../../../
:mrdocs:

Storage area for a functor representation using small&hyphen;object optimization&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;function&lowbar;smallobjectoptimization&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
union InplaceBuffer;
----

== Description

This `union` defines the storage area for a functor representation&period; The design uses the small&hyphen;object optimization in an attempt to avoid allocations for objects that are no larger than `InplaceBuffer`&period; When the target object is no larger than `InplaceBuffer`, the small&hyphen;object optimization can be used by storing the target directly within the `InplaceBuffer`&period;

Note that union members other than `d&lowbar;object&lowbar;p` are just fillers to make sure that a function or member function pointer can fit without allocation, and that `InplaceBuffer` has maximum alignment&period; The `d&lowbar;minbuf` member ensures that `InplaceBuffer` is large enough to hold modestly complex functors, like `bdlf&colon;&colon;Bind` objects and other functors that store embedded arguments, eliminating the need to allocate memory from the heap for the footprint of such objects&period;

The size of this type ensures that the inplace buffer will be 6 pointers in size, and the total footprint of a `bsl&colon;&colon;function` object on most platforms will be 10 pointers, which matches the sizes of previous implementations of `bdef&lowbar;Function`&period;

== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_align.adoc[`d&lowbar;align`] [.small]#[variant member]#
| Force alignment of the inplace buffer&period;
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_func_p.adoc[`d&lowbar;func&lowbar;p`] [.small]#[variant member]#
| Pointer to a function stored in the inplace buffer&period;
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_memData_p.adoc[`d&lowbar;memData&lowbar;p`] [.small]#[variant member]#
| Pointer to member data stored in the inplace buffer&period;
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_memFunc_p.adoc[`d&lowbar;memFunc&lowbar;p`] [.small]#[variant member]#
| Pointer to a member function stored in the inplace buffer&period;
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_minbuf.adoc[`d&lowbar;minbuf`] [.small]#[variant member]#
| Minimum buffer size for the inplace representation&period;
| xref:BloombergLP/bslstl/Function_SmallObjectOptimization/InplaceBuffer/d_object_p.adoc[`d&lowbar;object&lowbar;p`] [.small]#[variant member]#
| Pointer to an external representation stored out of line&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
