boost-lambda

    2熱度

    1回答

    我有作爲的解決方案 enum Opcode { OpFoo, OpBar, OpQux, }; // this should be a pure virtual ("abstract") base class class Operation { // ... }; class OperationFoo: public Operation {

    4熱度

    1回答

    我正在嘗試將迭代器返回到過濾範圍中的最大元素。以下是我迄今爲止: #include <boost/lambda/lambda.hpp> #include <boost/range/adaptors.hpp> #include <boost/range/algorithm.hpp> #include <vector> #include <iostream> using namespace

    2熱度

    1回答

    我認爲這可能是有用的存儲綁定的lambda函數稍後使用,但我還沒有看到boost::lambda::bind函數的返回值分配給該返回類型的對象的任何示例。沒有辦法做到這一點乾淨,還是沒有理由去做這件事? 例子: boost::lambda::lambda_functor<?> lf = boost::lambda::bind(boost::lambda::constructor<Foo>(), x

    0熱度

    1回答

    假設我有以下代碼: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <boost/function.hpp> #include <list> class MyListChild

    1熱度

    1回答

    我的關注升壓拉姆達簡易程序噴涌而出以下錯誤: maxInMap.cpp:29:71: instantiated from here /usr/include/boost/lambda/detail/function_adaptors.hpp:264:15: error: invalid initialization of reference of type ‘std::vector<int>&’

    0熱度

    1回答

    我想要做的是 - >在新線程中創建一個新對象。 喜歡的東西: Class* object = 0; Arg arg; boost::thread t(lambda::bind(object = lambda::new_ptr<Class>()(boost::ref(arg)); 它不能編譯,什麼是正確的做法?

    0熱度

    2回答

    可以使用boost :: lambda 遞歸? 這並不編譯: using namespace boost::lambda; auto factorial = (_1 == 0) ? 1 : factorial(_1-1); 是否有建議的解決方法? 編輯:關於使用C++ 11 lambda表達式:下面的VS2012不能編譯: std::function<int(int)> factorial

    1熱度

    2回答

    我試圖創建vector<Wrap>,其值與v中的值相同。我嘗試了下面的組合,沒有工作! using namespace std; struct Wrap { int data; //Other members }; int main() { int a[10] = {2345,6345,3,243,24,234}; vector<int> v(

    2熱度

    2回答

    我可以使用boost :: bind或boost lambda函數庫來創建忽略其參數並始終返回常量的仿函數嗎? 例如具有同等行爲的函子: int returnThree(SomeType arg) { return 3; }

    4熱度

    1回答

    我試圖用boost::lambda::bind()來定義一個謂詞,我將它傳遞給Boost.Range中的find_if算法。具體來說,我想搜索一個結構向量來查找特定成員具有指定值的第一個條目。我的例子如下: #include <boost/lambda/bind.hpp> #include <boost/range/algorithm/find_if.hpp> #include <vector