26 Apr
2010
26 Apr
'10
8:34 p.m.
Hello, This code proceces "xyz", contrary to user intention to bind "abc": void echo(const char* s) { cout << s << '\n'; } int main() { string s("abc"); function<void ()> f = boost::bind(echo, s.c_str()); s = "xyz"; f(); } This is misleading. Changing "echo(const char*)" into "echo(string)" produces "abc", as expected. Is there any way (other than echo wrapper) to get "abc" as expected? -- Piotr Jachowicz