libycxx

class template

ycxx::uses_inline_storage

Status
libycxx extension; include its header (not exported by import std;)
Scope
ycxx

Reports whether a decayed target type meets a wrapper's inline-storage policy.

Synopsis

template<class Wrapper, class Target>
struct uses_inline_storage
    : std::false_type

Specializations

Derived classes

Description

A std::bool_constant trait for libycxx's std::function, std::move_only_function, std::copyable_function, and ycxx::inplace_function. Its value is true when decay_t<Target> fits the wrapper's target buffer, meets its alignment limit, and is nothrow move constructible. Unknown wrappers, void and incomplete target types yield false. The wrapper type must be unqualified. Targets are decayed, so a function type is tested as a function pointer.

This checks storage properties only. It does not check call-signature compatibility, copyability, or construction from a particular argument. It does not inspect an erased wrapper's current runtime target, or describe transfers that adopt another wrapper's target. True means no wrapper allocation for an otherwise valid target construction; target code itself can still allocate. Policy values may change between libycxx ABI revisions.


auto task = [a = 1, b = 2] { return a + b; };
static_assert(ycxx::uses_inline_storage_v<std::function<int()>, decltype(task)>);

Template parameters

Wrapper
Unqualified owning wrapper type.
Target
Target type, decayed before checking storage properties.