从 boost::bind 文档(http://www.boost.org/doc/libs/1_53_0/libs/bind/bind.html#with_functions)中,“绑定的参数被复制并由返回的函数在内部保存对象”,但是如果有办法可以将参数复制到那些函数对象中?
IE:
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <string>
using namespace std;
void doSomthing(std::string str)
{
}
int main()
{
boost::function<void(void)> func_obj = boost::bind(&doSomthing, "some string");
//how can I get the std::string argument("some string") through func_obj?
}
提前致谢。