You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The types `Fty, T1, T2, ..., TN` must be copy constructible, and `INVOKE(fn, t1, ..., tN)` must be a valid expression for some values `w1, w2, ..., wN`.
59
59
60
-
The first template function returns a forwarding call wrapper `g` with a weak result type. The effect of `g(u1, u2, ..., uM)` is `INVOKE(f, v1, v2, ..., vN, `[result_of](../standard-library/result-of-class.md)`<Fty cv (V1, V2, ..., VN)>::type)`, where `cv` is the cv-qualifiers of `g` and the values and types of the bound arguments `v1, v2, ..., vN` are determined as specified below. You use it to bind arguments to a callable object to make a callable object with a tailored argument list.
60
+
The first template function returns a forwarding call wrapper `g` with a weak result type. The effect of `g(u1, u2, ..., uM)` is `INVOKE(f, v1, v2, ..., vN, `[invoke_result](../standard-library/invoke-result-class.md)`<Fty cv (V1, V2, ..., VN)>::type)`, where `cv` is the cv-qualifiers of `g` and the values and types of the bound arguments `v1, v2, ..., vN` are determined as specified below. You use it to bind arguments to a callable object to make a callable object with a tailored argument list.
61
61
62
62
The second template function returns a forwarding call wrapper `g` with a nested type `result_type` that is a synonym for `Ret`. The effect of `g(u1, u2, ..., uM)` is `INVOKE(f, v1, v2, ..., vN, Ret)`, where `cv` is the cv-qualifiers of `g` and the values and types of the bound arguments `v1, v2, ..., vN` are determined as specified below. You use it to bind arguments to a callable object to make a callable object with a tailored argument list and with a specified return type.
63
63
@@ -128,7 +128,7 @@ int main()
128
128
3^2 == 9
129
129
```
130
130
131
-
## <aname="bind1st"></a> bind1st
131
+
## <aname="bind1st"></a> bind1st
132
132
133
133
A helper template function that creates an adaptor to convert a binary function object into a unary function object by binding the first argument of the binary function to a specified value. Deprecated in C++11, removed in C++17.
134
134
@@ -222,7 +222,7 @@ The number of elements in v1 greater than 5 is: 4.
222
222
The number of elements in v1 less than 10 is: 2.
223
223
```
224
224
225
-
## <aname="bind2nd"></a> bind2nd
225
+
## <aname="bind2nd"></a> bind2nd
226
226
227
227
A helper template function that creates an adaptor to convert a binary function object into a unary function object by binding the second argument of the binary function to a specified value. Deprecated in C++11, removed in C++17.
228
228
@@ -316,7 +316,7 @@ The number of elements in v1 greater than 15 is: 2.
316
316
The number of elements in v1 less than 10 is: 2.
317
317
```
318
318
319
-
## <aname="bit_and"></a> bit_and
319
+
## <aname="bit_and"></a> bit_and
320
320
321
321
A predefined function object that performs the bitwise AND operation (binary `operator&`) on its arguments.
322
322
@@ -357,7 +357,7 @@ The result of `Left & Right`. The specialized template does perfect forwarding o
357
357
358
358
The `bit_and` functor is restricted to integral types for the basic data types, or to user-defined types that implement binary `operator&`.
359
359
360
-
## <a name="bit_not"></a> bit_not
360
+
## <a name="bit_not"></a> bit_not
361
361
362
362
A predefined function object that performs the bitwise complement (NOT) operation (unary `operator~`) on its argument. Added in C++14.
363
363
@@ -373,7 +373,7 @@ template <>
373
373
struct bit_not<void>
374
374
{
375
375
template <class Type>
376
-
auto operator()(Type&& Right) const -> decltype(~std::forward<Type>(Right));
376
+
auto operator()(Type&& Right) const -> decltype(~std::forward<Type>(Right));
377
377
};
378
378
```
379
379
@@ -393,7 +393,7 @@ The result of `~ Right`. The specialized template does perfect forwarding of the
393
393
394
394
The `bit_not` functor is restricted to integral types for the basic data types, or to user-defined types that implement binary `operator~`.
395
395
396
-
## <aname="bit_or"></a> bit_or
396
+
## <aname="bit_or"></a> bit_or
397
397
398
398
A predefined function object that performs the bitwise OR operation (`operator|`) on its arguments.
The **noexcept** specification `std::is_nothrow_invocable_v<Callable, Args>)`.
623
+
624
+
### Remarks
625
+
626
+
Invokes the callable object *fn* using the parameters *args*. Effectively, `INVOKE(std::forward<Callable>(fn), std::forward<Args>(args)...)`, where the pseudo-function `INVOKE(f, t1, t2, ..., tN)` means one of the following things:
627
+
628
+
- `(t1.*f)(t2, ..., tN)` when `f` is a pointer to member function of class `T` and `t1` is an object of type `T` or a reference to an object of type `T` or a reference to an object of a type derived from `T`. That is, when `std::is_base_of<T, std::decay_t<decltype(t1)>>::value` is true.
629
+
630
+
- `(t1.get().*f)(t2, ..., tN)` when `f` is a pointer to member function of class `T` and `std::decay_t<decltype(t1)>` is a specialization of `std::reference_wrapper`.
631
+
632
+
- `((*t1).*f)(t2, ..., tN)` when `f` is a pointer to member function of class `T` and `t1` is not one of the previous types.
633
+
634
+
- `t1.*f` when N == 1 and `f` is a pointer to member data of a class `T` and `t1` is an object of type `T` or a reference to an object of type `T` or a reference to an object of a type derived from `T`. That is, when `std::is_base_of<T, std::decay_t<decltype(t1)>>::value` is true.
635
+
636
+
- `t1.get().*f` when N == 1 and `f` is a pointer to member data of a class `T` and `std::decay_t<decltype(t1)>` is a specialization of `std::reference_wrapper`.
637
+
638
+
- `(*t1).*f` when N == 1 and `f` is a pointer to member data of a class `T` and `t1` is not one of the previous types.
639
+
640
+
- `f(t1, t2, ..., tN)` in all other cases.
641
+
642
+
For information on the result type of a callable object, see [invoke_result](invoke-result-class.md). For predicates on callable types, see [is_invocable, is_invocable_r, is_nothrow_invocable, is_nothrow_invocable_r classes](is-invocable-classes.md).
Helper template functions used to construct function object adaptors for member functions when initialized with pointer arguments. Deprecated in C++11, removed in C++17.
600
707
@@ -681,7 +788,7 @@ int main( )
681
788
}
682
789
```
683
790
684
-
## <aname="mem_fun_ref"></a> mem_fun_ref
791
+
## <aname="mem_fun_ref"></a> mem_fun_ref
685
792
686
793
Helper template functions used to construct function object adaptors for member functions when initialized by using reference arguments. Deprecated in C++11, removed in C++17.
687
794
@@ -786,7 +893,7 @@ The original values stored in v2 are: 1 2 3 4 5 6 7 8 9 10 11 12 13
786
893
With the even numbers removed, the remaining values are: 1 3 5 7 9 11 13
787
894
```
788
895
789
-
## <aname="not1"></a> not1
896
+
## <aname="not1"></a> not1
790
897
791
898
Returns the complement of a unary predicate. Deprecated in favor of [not_fn](#not_fn) in C++17.
792
899
@@ -858,7 +965,7 @@ The number of elements in v1 greater than 10 is: 5.
858
965
The number of elements in v1 not greater than 10 is: 3.
859
966
```
860
967
861
-
## <aname="not2"></a> not2
968
+
## <aname="not2"></a> not2
862
969
863
970
Returns the complement of a binary predicate. Deprecated in favor of [not_fn](#not_fn) in C++17.
864
971
@@ -1034,7 +1141,7 @@ Elements divisible by three: 2
1034
1141
Elements not divisible by three: 5
1035
1142
```
1036
1143
1037
-
## <aname="ptr_fun"></a> ptr_fun
1144
+
## <aname="ptr_fun"></a> ptr_fun
1038
1145
1039
1146
Helper template functions used to convert unary and binary function pointers, respectively, into unary and binary adaptable functions. Deprecated in C++11, removed in C++17.
1040
1147
@@ -1065,7 +1172,7 @@ A function pointer is a function object and may be passed to any C++ Standard Li
Determines the return type of the callable type that takes the specified argument types at compile time. Added in C++17.
10
+
11
+
## Syntax
12
+
13
+
```cpp
14
+
template <classCallable, class... Args>
15
+
struct invoke_result<Callable(Args...)>;
16
+
17
+
// Helper type
18
+
template<lass Callable, class... Args>
19
+
using invoke_result_t = typename invoke_result<Callable, Args...>::type;
20
+
```
21
+
22
+
### Parameters
23
+
24
+
*Callable*<br/>
25
+
The callable type to query.
26
+
27
+
*Args*<br/>
28
+
The types of the argument list to the callable type to query.
29
+
30
+
## Remarks
31
+
32
+
Use this template to determine the result type of *Callable*(*Args*...) at compile time, where *Callable* and all types in *Args* are any complete type, an array of unknown bound, or a possibly cv-qualified `void`. The `type` member of the template class names the return type of *Callable* when invoked using the arguments *Args*.... The `type` member is only defined if *Callable* can be called when invoked using the arguments *Args*... in an unevaluated context. Otherwise, the template class has no member `type`, which allows SFINAE tests on a particular set of argument types at compile time.
0 commit comments