Quick Links:

bal | bbl | bdl | bsl

Classes | Static Public Attributes

bslstl::Function_SmallObjectOptimization Class Reference

#include <bslstl_function_smallobjectoptimization.h>

List of all members.

Classes

union  InplaceBuffer
class  SooFuncSize

Static Public Attributes

static const std::size_t k_NON_SOO_SMALL_SIZE = ~sizeof(InplaceBuffer)

Detailed Description

This utility struct provides a namespace for several types, type traits, and constants used in the implementation of the small-object optimization for bsl::function.

See Component bslstl_function_smallobjectoptimization


Member Data Documentation

SooFuncSize (below) adds this value to the size of a small stateful functor to indicate that, despite being small, it should not be allocated inplace using the small object optimization (SOO), i.e., because it does not have a nothrow move constructor and cannot, therefore, be swapped safely. When a size larger than this constant is seen, the actual object size can be determined by subtracting this constant. A useful quality of this encoding is that if SZ <= sizeof(InplaceBuffer) for some object size SZ, then SZ + k_NON_SOO_SMALL_SIZE > sizeof(InplaceBuffer), thus SooFuncSize (below) for any object that should not be allocated inplace is larger than sizeof(InplaceBuffer), and the SooFuncSize for any object that should be allocated inplace is smaller than or equal to sizeof(InplaceBuffer), making the test for "is inplace function" simple. Note that it is assumed that no actual object has a size larger than this constant.


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