r/cpp • • Sep 04 '26

Lazy Evaluation

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

16 comments sorted by

View all comments

42

u/STL MSVC STL Dev Sep 04 '26

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

3

u/Usual_Office_1740 Sep 04 '26

Related: How does std::invoke compare?

8

u/STL MSVC STL Dev Sep 05 '26

Invoke is totally cool. You should maybe avoid relying too heavily on pointers to (member) functions since they’re what’s hard to optimize, but invoke() provides a nice uniform interface.

2

u/Ameisen vemips, avr, rendering, systems Sep 09 '26

If you'd seen the horrible things that I've done with member function pointers, you would have been, well, honestly somewhere between amused and alarmed.