Configuration options#
-
template<typename DefaultValueType = void, typename RefIFace = no_ref_iface>
requires (std::same_as<DefaultValueType, void> || valid_value_type<DefaultValueType>) && valid_ref_iface<RefIFace>
struct config# Configuration struct.
This struct stores tunable config options for the
wrapclass.DefaultValueTyperepresents the type used by the default constructor ofwrap. If set tovoid, the default constructor ofwrapis disabled (unless theinvalid_default_ctoroption is set totrue, see below).RefIFaceis the reference interface selected for thewrapclass. The default typeno_ref_ifaceselects an empty reference interface.-
std::size_t static_size = 48#
Threshold size (in bytes) for the small-object optimisation in the
wrapclass. If set to zero, the small-object optimisation is disabled and thewrapclass always uses dynamically-allocated memory.
-
std::size_t static_align = alignof(std::max_align_t)#
Alignment (in bytes) for the small-object optimisation in the
wrapclass. This value must be a power of two.
-
bool invalid_default_ctor = false#
If this option is set to
true, then the default constructor ofwrapinitialises to the invalid state. Otherwise, the default constructor ofwrapis disabled, unless a non-voidDefaultValueTypeis selected.
-
bool pointer_interface = true#
This option selects whether or not the pointer interface is enabled.
-
wrap_ctor explicit_ctor = wrap_ctor::always_explicit#
This option selects when the generic constructor of the
wrapclass isexplicit.
-
wrap_semantics semantics = wrap_semantics::value#
This option selects the semantics for the
wrapclass.
-
bool copyable = true#
This option selects whether or not the
wrapclass is copy constructible/assignable.This option is ignored when employing reference semantics.
-
bool movable = true#
This option selects whether or not the
wrapclass is move constructible/assignable.This option is ignored when employing reference semantics.
-
bool swappable = true#
This option selects whether or not the
wrapclass is swappable.This option is ignored when employing reference semantics.
-
std::size_t static_size = 48#
-
struct no_ref_iface#
A placeholder type that represents an empty reference interface. This is a trivial empty struct.
-
enum class wrap_ctor#
Enumerator representing the explicitness of the generic constructor of the
wrapclass.-
enumerator always_explicit#
The constructor is always
explicit.
-
enumerator ref_implicit#
The constructor is implicit when constructing from a
std::reference_wrapper,explicitotherwise.
-
enumerator always_implicit#
The constructor is always implicit.
-
enumerator always_explicit#
-
enum class wrap_semantics#
Enumerator representing the semantics chosen for a
wrapclass.-
enumerator value#
Value semantics.
-
enumerator reference#
-
enumerator value#
-
template<typename T, typename IFace>
requires iface_with_impl<IFace, T>
inline constexpr std::size_t holder_size# Helper to compute the total amount of memory (in bytes) needed to statically store in a
wrapa value of typeTwrapped by the interfaceIFace.
-
template<typename T, typename IFace>
requires iface_with_impl<IFace, T>
inline constexpr std::size_t holder_align# Helper to compute the alignment (in bytes) required to statically store in a
wrapa value of typeTwrapped by the interfaceIFace.
-
template<typename RefIFace>
concept valid_ref_iface# This concept is satisfied if
RefIFaceis a valid reference interface.When using C++23, this concept is satisfied by any non-cv qualified class type. In C++20,
RefIFacemust also define in its scope animplclass template/template alias depending exactly on one parameter.
-
template<auto Cfg>
concept valid_config# Concept for checking that
Cfgis a valid instance ofconfig.Specifically, the concept is satisfied if:
config::static_alignis a power of two,config::explicit_ctoris one of the enumerators defined inwrap_ctor,config::semanticsis one of the enumerators defined inwrap_semantics,if
config::copyableis set totrue, so isconfig::movable(that is, a copyablewrapmust also be movable),if
config::movableis set totrue, so isconfig::swappable(that is, a movablewrapmust also be swappable).