I am trying to use std::invoke()
with an overloaded function:
#include <iostream>
#include <functional>
struct S {
void foo(int) { }
void foo(int, int) { }
};
int main()
{
S s;
std::invoke(&S::foo, s, 1);
}
but I get an error: 'std::invoke': no matching overloaded function found
. It works fine, when there is the only one function with name foo()
. Is it possible to use std::invoke()
when a function is overloaded?