Quick Links:

bal | bbl | bdl | bsl

Public Attributes

bslstl::Function_SmallObjectOptimization::InplaceBuffer Union Reference

#include <bslstl_function_smallobjectoptimization.h>

List of all members.

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.

See Component bslstl_function_smallobjectoptimization


Member Data Documentation

pointer to external rep

pointer to function

pointer to member function

pointer to member data

force alignment

force minimum size


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