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
auto rangeLambda = MakeDelegate([](int v) { return v > 2 && v <= 6; });
876
874
bool inRange = rangeLambda(6);
877
875
```
878
876
@@ -988,14 +986,14 @@ Stack arguments passed by pointer/reference do not be thread-safe. The reason is
988
986
A blocking delegate must specify a timeout in milliseconds or `WAIT_INFINITE`. Unlike a non-blocking asynchronous delegate, which is guaranteed to be invoked, if the timeout expires on a blocking delegate, the function is not invoked. Use `IsSuccess()` to determine if the delegate succeeded or not.
989
987
990
988
```cpp
991
-
std::function LambdaFunc1 = [](int i) -> int
992
-
{
993
-
cout << "Called LambdaFunc1 " << i << std::endl;
994
-
return ++i;
995
-
};
996
-
997
989
// Asynchronously invoke lambda on workerThread1 and wait for the return value
998
-
auto lambdaDelegate1 = MakeDelegate(LambdaFunc1, workerThread1, WAIT_INFINITE);
990
+
auto lambdaDelegate1 = MakeDelegate(
991
+
[](int i) -> int {
992
+
cout << "Called LambdaFunc1 " << i << std::endl;
993
+
return ++i;
994
+
},
995
+
workerThread1, WAIT_INFINITE
996
+
);
999
997
int lambdaRetVal2 = lambdaDelegate1(123);
1000
998
```
1001
999
@@ -1004,7 +1002,7 @@ Delegates are callable and therefore may be passed to the standard library. The
Occasionally, you may not want the delegate library to copy your arguments. Instead, you just want the destination thread to have a pointer to the original copy. A `std::shared_ptr` function argument does not copy the object pointed to when using an asynchronous delegate target function.
0 commit comments