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, "); /