r/cpp 6h ago

Lazy Evaluation

https://breese.github.io/2026/09/03/lazy-prologue.html
3 Upvotes

4 comments sorted by

11

u/STL MSVC STL Dev 4h ago

Classic bind is bad. Don't use it. It's hard to understand, hard to optimize, and lambdas are better in basically every way.

u/germandiago 9m ago

Related: is bind_front/back as bad from an optimization point of view?

u/n1ghtyunso 3h ago

thats quite some build-up regarding std::bind usefulness and then all we get is a single short sentence?
huh?

having never used bind expressions myself, i was tempted to believe this works, but it seems the nested bind example doesnt compile anyway?
https://godbolt.org/z/K61jKvjWP

u/UnusualPace679 1h ago

Yeah, std::bind only transforms the bound arguments. It doesn't transform the function object.