stdbind

    1热度

    2回答

    我正在使用VC++编译我的程序(使用Visual Studio 2015,更新3),并且某些代码段无法编译。 基本上,我想绑定一个函数,该函数获取对原子布尔值的引用与原子布尔值。自包含的代码: void stub(std::atomic_bool& b) { b = true; } int main() { std::atomic_bool b(false);

    0热度

    1回答

    我试图用std :: function和std :: bind绑定方法时遇到问题。 在我CommunicationService类: this->httpServer->BindGET(std::bind(&CommunicationService::ManageGETRequest, this, std::placeholders::_1)); CommunicationService ::

    -1热度

    1回答

    在我的iOS Cocos2dx应用程序中,std :: bind似乎无法应付4个绑定参数(对于4参数静态函数)。第四个观点总是垃圾。 我该如何检查XCode(使用clang)std :: bind的最大参数数量?我可以改变它吗? 或者它在科科斯的一些设置?

    2热度

    1回答

    我一直在试图编写一段非常简单的代码,但它似乎不工作,我无法从编译器中做出任何意义错误。 代码: #include <iostream> #include <sstream> #include <functional> class c { public: void test(std::stringstream ss){ std::cout<<ss.str()<<st

    2热度

    1回答

    昨天我已经实现了一些测试函数,并且所有的编译和工作都没有错误。今天,我回到我的电脑,我的std::bind的下划线是红色的,但编译没有错误。看起来像Intellisense和编译器不同意std::bind类型。我怎样才能解决这个问题? #include <functional> class MyClass { public: int doE() { return 0;

    0热度

    1回答

    我需要将一个参数绑定到类成员函数。 事情是这样的: #include <functional> #include <iostream> struct test { void func(int a, int b) { std::cout << a << " " << b << std::endl; } }; int main(int argc,

    1热度

    2回答

    我的问题是我在下面指出ERROR的那一行给出错误,因为std :: thread构造函数计算出要调用的函数并且需要函数签名所需的参数 。 有什么办法解决这个问题吗?如果我试图解码来自packaged_task的函数名称和参数列表,那么我无法使用get_future函数来打包任务,并且需要添加我自己的承诺/将来的代码来处理这个问题。 #include<iostream> #include<stri

    0热度

    1回答

    我正在工作的一些代码,要求我能够绑定一个函数使用std::bind可能有一些参数绑定和一些参数留作占位符。 我有一个类: template <typename return_t,typename... args_t> class signal_base<return_t(args_t...)> { using slot_t = std::function<return_t(args_

    0热度

    1回答

    我试图使用std::bind与抽象类中的虚拟纯函数,但 我使用设计模式调用策略,因为我想要一个程序,可以处理动态切换游戏。 我没有得到语法。这里是代码: 这里是我的接口类 class IGame { public: virtual ~IGame(){}; virtual void move_up(INFO &info)=0; } 顺便说INFO是一个定义: #

    0热度

    1回答

    我想创建一个模板类,它将反过来生成一个函数的包装。该类将随后返回包装。我想用模板具有将与任何功能的工作与不同的签名,如普通类: std::function<void()>task = std::bind(fun1, param1, param2); std::function<int(int, int)>task = std::bind(fun2, param1, param2); 我想有这样的事