boost-lambda

    2热度

    2回答

    我正在尝试使用boost lambda来避免编写简单的函数。 例如,我想用lambda来访问结构的成员或调用类的方法,如: #include <vector> #include <utility> #include <algorithm> #include <boost/lambda/lambda.hpp> using namespace std; using namespace bo

    2热度

    2回答

    我试图创建一个简单的函数,使得一个简单的测试并返回true或false。 myfunct = (_3 < someArray[i]); 当我这样做,我得到这个错误: error: no match for 'operator<' in '<unnamed>::_1 < depths[i]' 我所希望的是得到的东西相当于这个 bool myFunct(unsigned int a, unsi

    2热度

    1回答

    我想倾斜boost :: bind,boost :: lambda库以及它们如何与STL算法一起使用。假设我有一个由int键排序的int-string对的向量。然后一个地方插入一对新的,同时保持排序的矢量可以发现如下: std::vector<std::pair<int, string> > entries; ... int k = ...; // Let's ignore std::lo

    1热度

    1回答

    为什么这个boost :: lambda表达式不起作用? boost::function<bool (boost::uint64_t, boost::uint64_t&, unsigned int, float)> myFunct = boost::lambda::_3 < 1; 我得到了这些编译错误,这可能不会有帮助,因为它们真的很神秘。 || In file included from /

    2热度

    2回答

    我是新手,想要写一些简单的程序来理解它。在下面这段代码中,我试图用随机数填充一个数组。这里是我的代码: using namespace boost::lambda; srand(time(NULL)); boost::array<int,100> a; std::for_each(a.begin(), a.end(), _1=rand()); 但它看起来像rand

    1热度

    2回答

    我想通过lambda :: bind调用成员。不幸的是,我有两个具有相同名称但返回类型不同的成员。 有没有办法来帮助lambda :: bind推断成员函数调用的正确返回类型? (结合正常工作与明确的返回类型扣) #include <vector> #include <iostream> #include <algorithm> #include <boost/bind.hpp> #inc

    0热度

    2回答

    我正在寻找boost :: lambda作为一种通用算法,可以与任何类的任何“getter”方法一起使用。 该算法用于检测属性的重复值,我希望它适用于任何类的任何属性。 在C#中,我会做这样的事情: class Dummy { public String GetId() ... public String GetName() ... } IEnumerable<Stri

    1热度

    2回答

    我想获得下面的代码片段进行编译。但它失败: 错误C2665:'boost :: lambda :: function_adaptor :: apply':8个重载都不能转换所有的参数类型。在调用绑定时指定返回类型无济于事。 任何想法我做错了什么? #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #inclu

    0热度

    1回答

    我似乎无法在boost_1_39_0发行版中的任何头文件中找到boost :: lambda :: ll的嵌套ll :: for_each()调用。有人能指出我正确的方向吗?谢谢。

    2热度

    1回答

    我正在学习boost::lambda库,为此我编写了此示例代码,通过从A对象中提取值来将vector<A>转换为vector<int>。 class A { public: A(int n) : m_n(n){} int get() const {return m_n;} private: int m_n; }; int _tmain(int argc