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