C++23's `invoke_r` vs `invoke`
https://en.cppreference.com/w/cpp/utility/functional/invoke
Interestingly, it appears to be possible to implement std::reference_converts_from_temporary in C++11, so the fact it took until C++23 is a bit surprising. Or maybe there is some part of it that requires compiler support, but I'm not sure what.
@LB-- I'm confused by your reference to reference_converts_from_temporary I don't see how that comes into play for this episode
It's used in the definition of the INVOKE<R> exposition-only operation: https://en.cppreference.com/w/cpp/utility/functional
In particular this means
std::invoke_r protects you from creating dangling references in some cases.
invoke_r can only invoke implicit conversions, and we know that we don't want implicit conversions.
Worse, because it's a stdlib header file, any warnings that would have been generated are hidden by the compiler (gcc and clang, only MSVC is good enough to not exclude itself from these warnings)
https://compiler-explorer.com/z/8rYnjea1e
Episode 466