從boost :: bind docs(http://www.boost.org/doc/libs/1_53_0/libs/bind/bind.html#with_functions),「綁定的參數被複制並由內部返回的函數對象保存」,但如果有辦法,我可以獲得複製到這些函數對象的參數?如何獲取綁定到boost :: function中的參數?
即:
#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?
}
在此先感謝。
你的意思是你想讀出來你func_objc變量?不太可能。 – PlasmaHH 2013-02-15 14:50:57
是的,這就是我的意思。 – cyber4ron 2013-02-15 14:57:55
我們已經提高1. ** 53 **現在,而不是1.35。 – 2013-02-15 15:00:36