Files
2025-10-25 03:02:53 +03:00

1.6 KiB

[func.wrap.general]

22 General utilities library [utilities]

22.10 Function objects [function.objects]

22.10.17 Polymorphic function wrappers [func.wrap]

22.10.17.1 General [func.wrap.general]

1

#

Subclause [func.wrap] describes polymorphic wrapper classes that encapsulate arbitrary callable objects.

2

#

Let t be an object of a type that is a specialization offunction, copyable_function, or move_only_function, such that the target object x of t has a type that is a specialization offunction, copyable_function, or move_only_function.

Each argument of the invocation of x evaluated as part of the invocation of t may alias an argument in the same position in the invocation of t that has the same type, even if the corresponding parameter is not of reference type.

[Example 1: move_only_function<void(T)> f{copyable_function<void(T)>{ {}}}; T t; f(t); // it is unspecified how many copies of T are made — end example]

3

#

Recommended practice: Implementations should avoid double wrapping when constructing polymorphic wrappers from one another.