
Golan Trevize wrote:
// the callback function string add5(string x) { int v; v =atoi(x.c_str()) + 5; string vystup = (char *)v; return vystup; }
I'm not sure about the regex problem, but I think that the callback doesn't do what you think it does. The first part does convert the number in x into its value + 5 in v, but the the second part doesn't convert v into a string. I think Boost.Lexical cast will help here, or you can use a std::stringstream: std::stringstream ss; ss << v; string vystup = ss.str(); You used a C style cast, (char *)v, which is generally a pretty bad idea in C++. The C++ casts (static_cast, dynamic_cast etc.) have better type safety than the C ones. By using a C cast you've turned off the type checking, but the type checker was trying to tell you something about the expression - shutting it up doesn't make the problem go away. K