function-pointers

    2热度

    2回答

    我有许多与它们各自的类对象绑定函数指针: ExampleClass EO; std::function<void()> Example=std::bind(&ExampleClass::ExampleFunction, &EO); 然而,我想“解除绑定”这些在以后,具体地,以确定每个'std :: function都涉及到的具体类。 auto Unbind(std::function<voi

    4热度

    2回答

    是下面的类(就在头): class Example { public: template<class C> Example(bool(C::*callbackFunc)(Foo&) = nullptr) : callbackFunc(callbackFunc); template<class C> ??? getCallbackFunc() cons

    2热度

    1回答

    我试图在C. 写链表在通用搜索功能的功能如下: void* get_when_true(linked_list *l, int (*condition)(const void*)) { node **walk = &l->head; while (*walk != NULL && !condition((*walk)->data)) { w

    4热度

    2回答

    也许是流感,或者我只是愚蠢的,但我不明白的一部分this乌鸦框架代码。我的内部C++解析器失败。 template <typename MW> struct check_before_handle_arity_3_const { template <typename T, //this line void (T::*)(int, typename MW::context&

    0热度

    3回答

    #include <stdio.h> #include <stdlib.h> int (*(*ptr[2])[2])(); //arr of pointers to the array of func pointer int (*arr_1[2])(int ,int);//arr of function pointers (*arr_1[])()={add1, sub1};//add1

    0热度

    3回答

    我是比较新的C++编程,我有一个分配来编码牛顿拉夫逊法,但是我有错误的错误: called object type 'double' is not a function or function pointer 当我尝试编译我的代码时出现此错误。我尝试了一些基本的改变来分配指针,但是我可能是以错误的方式做了,我的代码打印在下面,有人可以解释我该如何克服这个问题? #include <iostre

    0热度

    1回答

    我有以下CPP功能,并希望把它写R中 我用RCPP包来编译和使用,但发生 事实上,一些错误我有使用问题R中的指针 void creationPI(double *distC, int mC, int tailleC, double *PIC,int aC) //distC: distribution de X ; mC= smax-smin+1 ie u+v+1; tailleC=a+

    4热度

    2回答

    如何创建一个函数指针指向一个函数,其中一些参数被设置为在定义时被固定。 这里有一个例子我的意思: 比方说,我有功能 int add (int n, int m) { return n+m; } 和函数指针类型 typedef int (*increaser)(int); 我要的是一个函数指针add,它将第一个参数固定为1,并保持第二个参数打开。东西沿线 increaser f

    0热度

    3回答

    在P0012R1,“进行异常规格类型系统的一部分”, 我看到noexcept正在成为功能型的一部分。 我不能说这是否会阻止noexcept(true)函数仍然能够调用noexcept(false)函数。 以下代码对于C++ 17仍然有效吗? void will_throw() noexcept(false){ throw 0; } void will_not_throw() noe

    6热度

    2回答

    让我们来看看下面的代码: #include <stdio.h> typedef int (*callback) (void *arg); callback world = NULL; int f(void *_) { printf("World!"); return 0; } int main() { printf("Hello, "); /