boost-bind

    2熱度

    1回答

    我有一個簡單的代碼,可以很好地處理輸入選項只包含ASCII字符,但會拋出一個錯誤消息爲「error:character conversion failed」 。有解決方案嗎? 背景信息: 1. Compiler and OS: VC++2012 running on Windows 8.1 64 bit 2. "_UNICODE" option is ON It works with

    4熱度

    1回答

    我有一個派生類,從中我綁定了一個虛擬函數,我沒有在這個類中重寫,所以我希望調用其中一個父類。 它與提升(1.55)不錯,但如果我切換到標準::從C++ 11綁定,它拒絕與 錯誤C2100編譯:非法間接 1>功能(1152):見參考起作用模板實例 '_Rx的std :: _ Pmf_wrap < _Pmf_t,_Rx,_Farg0,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_

    0熱度

    1回答

    我嘗試綁定boost :: asio參數。綁定功能是結構的靜態成員: template <typename T> struct bind_struct{ typedef boost::system::error_code error_code; typedef boost::asio::ip::tcp::acceptor tcp_acceptor_typ

    2熱度

    1回答

    我正在嘗試使用Boost.Assign填充boost::property_tree::ptree。所以,我得到了以下工作得很好: namespace bpt = boost::property_tree; bpt::ptree pt; boost::assign::make_list_inserter (boost::bind(&bpt::ptree::put<std::string

    12熱度

    2回答

    有沒有辦法通過部分綁定第一個/最後一個?可調用對象(例如函數)的參數沒有明確指定其餘參數? std::bind()似乎要求所有參數都被綁定,那些被留下應該綁定到std::placeholders::_1,_2,_3等 是否可以寫一個部分bind_first()/bind_last()綁定從第一個/最後一個參數開始,並自動插入佔位符的任何剩餘的未綁定參數的原始順序在他們的原始位置?

    2熱度

    1回答

    我想創建一個菜單句柄來代替這樣的結構: void MyClass::handleMenu(MenuID id) { switch (id) { case option1: doFunction1(); break; case option2: doFunction2(true); break; case option3: memberVariable->do

    0熱度

    1回答

    我試圖通過使用std::for_each and boost::bind將map的所有密鑰複製到另一個。 我收到編譯錯誤說 error: no matching function for call to ‘bind(<unresolved overloaded function type>, boost::arg<1>&, boost::arg<1>&)’ 下面我的代碼。 using nam

    0熱度

    1回答

    我現在有這樣的事情 void asomeMethod(int q) { std::cout << "Method with parameter " << q ; } int main() { boost::function<void(int)> parfunct; parfunct = boost::bind(&asomeMethod,12); p

    1熱度

    1回答

    boost :: bind()綁定是否綁定了額外的參數,因爲它似乎將沒有參數的綁定函數傳遞給期望參數的雙重工作正常?如果我要明確寫出綁定函數,那應該是什麼? struct MyClass { void f() { std::cout << "f()" << std::endl; } }; void bar(const boost::function

    3熱度

    1回答

    所以我有什麼是: 兩個範圍的元素: std::vector<int> v1; std::vector<string> v2; 功能接受元素從theese範圍: void bar(int x, std::string str); 而我想要做的是從v1和v2產品中的每一對應用處理程序。所以我有這樣的事情: using namespace boost; for_each(v1, [&](in