Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
coyorkdow authored Feb 6, 2023
1 parent 5be9ba0 commit 9e92395
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ std::size_t sum(const int& v1, double v2, int v3, int v4) noexcept { return v1 +
using namespace closure;
auto closure1 = MakeClosure(sum, 1); // bind 1 to arg v1
// Or Closure<std::size_t(double, int, int)> closure1(sum, 1);
// Alternatively, Closure<std::size_t(double, int, int)> closure1(sum, 1);
static_assert(std::is_same<decltype(closure1), Closure<std::size_t(double, int, int)>>::value);
closure1(2, 3, 4); // result is 10
```

Alternatively, you can use placeholders. The number of placeholders is unlimited.
Or, you can use placeholders. The number of placeholders is unlimited.

```C++
auto lambda1 = [unused](int v1, int v2) { return v1 - v2; };
auto lambda1 = [](int v1, int v2) { return v1 - v2; };

auto closure1 = closure::MakeClosure(lambda1, closure::PlaceHolder<1>(), closure::PlaceHolder<0>());
closure1(5, 3); // result is -2
Expand Down

0 comments on commit 9e92395

Please sign in to comment.