#include <bslstl_function_smallobjectoptimization.h>
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 bslstl_function_smallobjectoptimization
◆ k_NON_SOO_SMALL_SIZE
const std::size_t bslstl::Function_SmallObjectOptimization::k_NON_SOO_SMALL_SIZE = ~sizeof(InplaceBuffer) |
|
static |
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: