Quick Links:

bal | bbl | bdl | bsl

Static Public Attributes

bslstl::Function_SmallObjectOptimization::SooFuncSize< TP > Class Template Reference

#include <bslstl_function_smallobjectoptimization.h>

List of all members.

Static Public Attributes

static const std::size_t value = sizeof(TP) + k_SOO_ENCODING_OFFSET

Detailed Description

template<class TP>
class bslstl::Function_SmallObjectOptimization::SooFuncSize< TP >

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:

  1. If TP is larger than InplaceBuffer, then value == sizeof(TP).
  2. Otherwise, if TP has a non-throwing destructive move (i.e., it is bitwise movable or has a noexcept move constructor), then value == sizeof(TP).
  3. Otherwise, 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


Member Data Documentation

template<class TP >
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.


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