Hacker News new | ask | show | jobs
by voldacar 2437 days ago
Poor man's lazy evaluation. I'm sure they'll try to shoehorn monads in somehow with C++23
2 comments

It's not lazy evaluation at all. Lazy evaluation is a runtime thing, where you delay evaluating an expression until you actually need to.

This concept is operators that will never evaluate the expressions they operate on.

sizeof is the oldschool obvious one, sizeof(foo()) never runs the function foo. It's just a way of querying the static properties of an expression, asking specific things about its type in a way.

They're not new things in C++. sizeof has been around since the beginning.

I'm not sure what lazy evaluation had to do with it... but it's something that will be much easier when concepts are in the language with C++20.