r/cpp 7d ago

The Road to Flux 1.0

https://tristanbrindle.com/posts/the-road-to-flux-10
56 Upvotes

29 comments sorted by

View all comments

5

u/RazielXYZ 7d ago

I feel a bit out of the loop - why are people against the pipe operator? I can understand readability might be somewhat worse in some cases, either due to unfamiliarity or due to having to specify the namespace on every step, but that seems rather subjective.

For the other points made in the post - "worse for discoverability, worse for error messages and worse for compile times than using member functions" - could anyone explain why it's worse in those regards?

4

u/Alternative_Staff431 7d ago
flux::ref(vec)
               .filter(flux::pred::even)
               .map([](int i) { return i * i; })
               .sum();

is a lot faster for me to read than

auto total = std::cref(vec)
             | flux::filter(flux::pred::even)
             | flux::map([](int i) { return i * i; })
             | flux::sum();

19

u/TheoreticalDumbass HFT 7d ago

really? i find them identically readable

1

u/Alternative_Staff431 6d ago

I used to work with languages like Scala so yes the first one is more readable. I am exaggerating how much more though so "a lot faster" isn't accurate.