[func.wrap.move.ctor] (original) (raw)

22 General utilities library [utilities]

22.10 Function objects [function.objects]

22.10.17 Polymorphic function wrappers [func.wrap]

22.10.17.4 Move-only wrapper [func.wrap.move]

22.10.17.4.3 Constructors, assignment, and destructor [func.wrap.move.ctor]

template<class VT> static constexpr bool _is-callable-from_ = _see below_;

If noex is true,is-callable-from<VT> is equal to:is_nothrow_invocable_r_v<R, VT cv _ref_, ArgTypes...> &&is_nothrow_invocable_r_v<R, VT _inv-quals_, ArgTypes...>

Otherwise, is-callable-from<VT> is equal to:is_invocable_r_v<R, VT cv _ref_, ArgTypes...> &&is_invocable_r_v<R, VT _inv-quals_, ArgTypes...>

move_only_function() noexcept; move_only_function(nullptr_t) noexcept;

Postconditions: *this has no target object.

move_only_function(move_only_function&& f) noexcept;

Postconditions: The target object of *this is the target object f had before construction, andf is in a valid state with an unspecified value.

template<class F> move_only_function(F&& f);

Constraints:

Mandates: is_constructible_v<VT, F> is true.

Postconditions: *this has no target object if any of the following hold:

Otherwise, *this has a target object of type VTdirect-non-list-initialized with std​::​forward<F>(f).

Throws: Any exception thrown by the initialization of the target object.

May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper.

template<class T, class... Args> explicit move_only_function(in_place_type_t<T>, Args&&... args);

Constraints:

Mandates: VT is the same type as T.

Postconditions: *this has a target object of type VTdirect-non-list-initialized with std​::​forward<Args>​(args)....

Throws: Any exception thrown by the initialization of the target object.

May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper.

template<class T, class U, class... Args> explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);

Constraints:

Mandates: VT is the same type as T.

Postconditions: *this has a target object of type VTdirect-non-list-initialized withilist, std​::​forward<Args>(args)....

Throws: Any exception thrown by the initialization of the target object.

May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper.

move_only_function& operator=(move_only_function&& f);

Effects: Equivalent to: move_only_function(std​::​move(f)).swap(*this);

move_only_function& operator=(nullptr_t) noexcept;

Effects: Destroys the target object of *this, if any.

template<class F> move_only_function& operator=(F&& f);

Effects: Equivalent to: move_only_function(std​::​forward<F>(f)).swap(*this);

Effects: Destroys the target object of *this, if any.