From Jason Turner

[func.not_fn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5o7ey_dc/{from.md → to.md} +0 -81
tmp/tmp5o7ey_dc/{from.md → to.md} RENAMED
@@ -1,81 +0,0 @@
1
- ### Function template `not_fn` <a id="func.not_fn">[[func.not_fn]]</a>
2
-
3
- ``` cpp
4
- template <class F> unspecified not_fn(F&& f);
5
- ```
6
-
7
- *Effects:* Equivalent to
8
- `return `*`call_wrapper`*`(std::forward<F>(f));` where *`call_wrapper`*
9
- is an exposition only class defined as follows:
10
-
11
- ``` cpp
12
- class call_wrapper {
13
- using FD = decay_t<F>;
14
- FD fd;
15
-
16
- explicit call_wrapper(F&& f);
17
-
18
- public:
19
- call_wrapper(call_wrapper&&) = default;
20
- call_wrapper(const call_wrapper&) = default;
21
-
22
- template<class... Args>
23
- auto operator()(Args&&...) &
24
- -> decltype(!declval<invoke_result_t<FD&, Args...>>());
25
-
26
- template<class... Args>
27
- auto operator()(Args&&...) const&
28
- -> decltype(!declval<invoke_result_t<const FD&, Args...>>());
29
-
30
- template<class... Args>
31
- auto operator()(Args&&...) &&
32
- -> decltype(!declval<invoke_result_t<FD, Args...>>());
33
-
34
- template<class... Args>
35
- auto operator()(Args&&...) const&&
36
- -> decltype(!declval<invoke_result_t<const FD, Args...>>());
37
- };
38
- ```
39
-
40
- ``` cpp
41
- explicit call_wrapper(F&& f);
42
- ```
43
-
44
- *Requires:* `FD` shall satisfy the requirements of `MoveConstructible`.
45
- `is_constructible_v<FD, F>` shall be `true`. `fd` shall be a callable
46
- object ([[func.def]]).
47
-
48
- *Effects:* Initializes `fd` from `std::forward<F>(f)`.
49
-
50
- *Throws:* Any exception thrown by construction of `fd`.
51
-
52
- ``` cpp
53
- template<class... Args>
54
- auto operator()(Args&&... args) &
55
- -> decltype(!declval<invoke_result_t<FD&, Args...>>());
56
- template<class... Args>
57
- auto operator()(Args&&... args) const&
58
- -> decltype(!declval<invoke_result_t<const FD&, Args...>>());
59
- ```
60
-
61
- *Effects:* Equivalent to:
62
-
63
- ``` cpp
64
- return !INVOKE(fd, std::forward<Args>(args)...); // see [func.require]
65
- ```
66
-
67
- ``` cpp
68
- template<class... Args>
69
- auto operator()(Args&&... args) &&
70
- -> decltype(!declval<invoke_result_t<FD, Args...>>());
71
- template<class... Args>
72
- auto operator()(Args&&... args) const&&
73
- -> decltype(!declval<invoke_result_t<const FD, Args...>>());
74
- ```
75
-
76
- *Effects:* Equivalent to:
77
-
78
- ``` cpp
79
- return !INVOKE(std::move(fd), std::forward<Args>(args)...); // see [func.require]
80
- ```
81
-