[func.wrap.func.general] (original) (raw)

20 General utilities library [utilities]

20.14 Function objects [function.objects]

20.14.17 Polymorphic function wrappers [func.wrap]

20.14.17.3 Class template function [func.wrap.func]

20.14.17.3.1 General [func.wrap.func.general]

namespace std { template<class> class function; template<class R, class... ArgTypes> class function<R(ArgTypes...)> { public: using result_type = R; function() noexcept; function(nullptr_t) noexcept; function(const function&); function(function&&) noexcept;template<class F> function(F); function& operator=(const function&); function& operator=(function&&); function& operator=(nullptr_t) noexcept;template<class F> function& operator=(F&&);template<class F> function& operator=(reference_wrapper<F>) noexcept;~function();void swap(function&) noexcept;explicit operator bool() const noexcept; R operator()(ArgTypes...) const;const type_info& target_type() const noexcept;template<class T> T* target() noexcept;template<class T> const T* target() const noexcept;};template<class R, class... ArgTypes> function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;template<class F> function(F) -> function<_see below_>;template<class R, class... ArgTypes> bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;template<class R, class... ArgTypes> void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;}

The function class template provides polymorphic wrappers that generalize the notion of a function pointer.

Wrappers can store, copy, and call arbitrary callable objects, given acall signature, allowing functions to be first-class objects.

[Note 1:

The types deduced by the deduction guides for functionmight change in future revisions of C++.

— _end note_]