[libc++][ranges] use `static operator()` for C++23 ranges (#86052)
## Abstract This pull request converts the `operator()` of all CPOs and niebloids related to C++23 ranges to `static`. ## Motivation In `libc++`, CPOs and niebloids are implemented as function objects. Currently, the `operator()` for such a function object is a `const`-qualified member function. This means that even if the function object is has no data members, an extra register is used to pass in the `this` pointer when calling `operator()`, unless the compiler can inline the function call. Declaraing `operator()` as `static` would optimize away the unnecessary `this` pointer passing for stateless function objects, since there is no object instance state that needs to be accessed. ## Reference - [P1169R4: static `operator()`](https://wg21.link/P1169R4)
parent
b621269d
Please register or sign in to comment