tmp/tmpkfalfqna/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### General <a id="func.wrap.func.general">[[func.wrap.func.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class> class function; // not defined
|
| 6 |
+
|
| 7 |
+
template<class R, class... ArgTypes>
|
| 8 |
+
class function<R(ArgTypes...)> {
|
| 9 |
+
public:
|
| 10 |
+
using result_type = R;
|
| 11 |
+
|
| 12 |
+
// [func.wrap.func.con], construct/copy/destroy
|
| 13 |
+
function() noexcept;
|
| 14 |
+
function(nullptr_t) noexcept;
|
| 15 |
+
function(const function&);
|
| 16 |
+
function(function&&) noexcept;
|
| 17 |
+
template<class F> function(F&&);
|
| 18 |
+
|
| 19 |
+
function& operator=(const function&);
|
| 20 |
+
function& operator=(function&&);
|
| 21 |
+
function& operator=(nullptr_t) noexcept;
|
| 22 |
+
template<class F> function& operator=(F&&);
|
| 23 |
+
template<class F> function& operator=(reference_wrapper<F>) noexcept;
|
| 24 |
+
|
| 25 |
+
~function();
|
| 26 |
+
|
| 27 |
+
// [func.wrap.func.mod], function modifiers
|
| 28 |
+
void swap(function&) noexcept;
|
| 29 |
+
|
| 30 |
+
// [func.wrap.func.cap], function capacity
|
| 31 |
+
explicit operator bool() const noexcept;
|
| 32 |
+
|
| 33 |
+
// [func.wrap.func.inv], function invocation
|
| 34 |
+
R operator()(ArgTypes...) const;
|
| 35 |
+
|
| 36 |
+
// [func.wrap.func.targ], function target access
|
| 37 |
+
const type_info& target_type() const noexcept;
|
| 38 |
+
template<class T> T* target() noexcept;
|
| 39 |
+
template<class T> const T* target() const noexcept;
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
template<class R, class... ArgTypes>
|
| 43 |
+
function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
|
| 44 |
+
|
| 45 |
+
template<class F> function(F) -> function<see below>;
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
The `function` class template provides polymorphic wrappers that
|
| 50 |
+
generalize the notion of a function pointer. Wrappers can store, copy,
|
| 51 |
+
and call arbitrary callable objects [[func.def]], given a call signature
|
| 52 |
+
[[func.def]].
|
| 53 |
+
|
| 54 |
+
A callable type [[func.def]] `F` is *Lvalue-Callable* for argument types
|
| 55 |
+
`ArgTypes` and return type `R` if the expression
|
| 56 |
+
`INVOKE<R>(declval<F&>(), declval<ArgTypes>()...)`, considered as an
|
| 57 |
+
unevaluated operand [[term.unevaluated.operand]], is well-formed
|
| 58 |
+
[[func.require]].
|
| 59 |
+
|
| 60 |
+
The `function` class template is a call wrapper [[func.def]] whose call
|
| 61 |
+
signature [[func.def]] is `R(ArgTypes...)`.
|
| 62 |
+
|
| 63 |
+
[*Note 1*: The types deduced by the deduction guides for `function`
|
| 64 |
+
might change in future revisions of C++. — *end note*]
|
| 65 |
+
|