It has been noted in similar questions (e.g. here) that you cannot pass class method pointers as predicates to std::all_of.
However, with C++17, we have std::invoke, which should make it easy for std::all_of and similar functions to accept member function (and even member variable) pointers.
To be more specific, the following does not compile on GCC 9.2:
#include <algorithm>
#include <vector>
struct S {
bool check() const { return true; }
};
int main() {
std::vector<S> vs;
std::all_of(vs.begin(), vs.end(), &S::check);
}
This Godbolt link contains some example code and a toy version of all_of using invoke.
Why this restriction? Am I missing something? I imagined that when std::invoke was standardised, it should also have been applied to appropriate STL functions.