I am trying to use std::bind within my lambda:
#include <functional>
#include <iostream>
#include <string>
struct Foo {
Foo() {}
void func(std::string input)
{
std::cout << input << '\n';
}
void bind()
{
std::cout << "bind attempt" << '\n';
auto f_sayHello = [this](std::string input) {std::bind(&Foo::func, this, input);};
f_sayHello("say hello");
}
};
int main()
{
Foo foo;
foo.bind();
}
What I do expect when I run this code, is to see following output
bind attempt
say hello
But I do only see "bind attempt". I am pretty sure there is something I don't understand with lambda.