Quick Links: |
#include <bslstl_function_smallobjectoptimization.h>
Static Public Attributes | |
static const std::size_t | value = sizeof(TP) + k_SOO_ENCODING_OFFSET |
This class template provides a metafunction that bsl::function
uses to determine the size of an object, and whether to store it using the small-object optimization (SOO) or not. The value
member of this class encodes the size of the specified TP
type as follows:
TP
is larger than InplaceBuffer
, then value == sizeof(TP)
. TP
has a non-throwing destructive move (i.e., it is bitwise movable or has a noexcept
move constructor), then value == sizeof(TP)
. value == sizeof(TP) + k_NON_SOO_SMALL_SIZE
. This encoding indicates that move might throw and, therefore, TP
should not be allocated in place even though it would fit in the footprint of an InplaceBuffer
. Note that the Soo
prefix is used to indicate that an identifier uses the above protocol. Thus, a variable called SooSize
is assumed to be encoded as above, whereas a variable called size
can generally be assumed not to be encoded that way.
See Component bslstl_function_smallobjectoptimization
const std::size_t bslstl::Function_SmallObjectOptimization::SooFuncSize< TP >::value = sizeof(TP) + k_SOO_ENCODING_OFFSET [static] |
value
encodes the size of the TP
type using the algorithm defined in the documentation for this class.