BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::Function_SmallObjectOptimization::InplaceBuffer Union Reference

#include <bslstl_function_smallobjectoptimization.h>

Public Attributes

void * d_object_p
 
void(* d_func_p )()
 
void(Dummy::* d_memFunc_p )()
 
int Dummy::* d_memData_p
 
MaxAlignedType d_align
 
void * d_minbuf [6]
 

Detailed Description

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.

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.

Member Data Documentation

◆ d_align

MaxAlignedType bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_align

◆ d_func_p

void(* bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_func_p) ()

◆ d_memData_p

int Dummy::* bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_memData_p

◆ d_memFunc_p

void(Dummy::* bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_memFunc_p) ()

◆ d_minbuf

void* bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_minbuf[6]

◆ d_object_p

void* bslstl::Function_SmallObjectOptimization::InplaceBuffer::d_object_p

The documentation for this union was generated from the following file: