MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1w7skdq/lazy_evaluation_operators/
r/cpp • u/pavel_v • Sep 05 '26
2 comments sorted by
12
The old bind still affording some cases more brevity than lambdas really makes me lament for terse lambdas (e.g. sort(first, last, (a, b) => a * a < b * b)).
bind
sort(first, last, (a, b) => a * a < b * b)
1
```
// c++17 and above AI generated such code 😄 )
template <char... C>
struct to_int {
static constexpr int value = [] {
int result = 0;
((result = result * 10 + (C - '0')), ...);
return result;
}();
};
12
u/fdwr fdwr@github 🔍 Sep 05 '26
The old
bindstill affording some cases more brevity than lambdas really makes me lament for terse lambdas (e.g.sort(first, last, (a, b) => a * a < b * b)).1
u/Expert_Sheepherder24 Sep 06 '26
```
// c++17 and above AI generated such code 😄 )
template <char... C>
struct to_int {
static constexpr int value = [] {
int result = 0;
((result = result * 10 + (C - '0')), ...);
return result;
}();
};
```