Skip to content

Commit

Permalink
Explain in more detail UFCS for issue #133
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 committed Mar 23, 2016
1 parent 088f81a commit b8950c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/src/more_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ It would be nice to write this:
.filter([](int x) { return x > 2; })
.transform([](int x) { return x * x; });

However, UFCS in C++17 won't allow this to be done generically. So instead
pipable functions can be used. So it can be written like this:
The proposal [N4165](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4165.pdf)
for Unified Call Syntax(UFCS) in C++17 would have allowed a function call of `x.f(y)` to become
`f(x, y)`. However, this was rejected by the comittee. So instead pipable functions can be
used to achieve extension methods. So it can be written like this:

auto r = numbers
| filter([](int x) { return x > 2; })
Expand Down

0 comments on commit b8950c5

Please sign in to comment.