function-pointers

function-pointers

文章 0 浏览 7

C++用捕获作为功能指针的lambda

我正在玩C ++ lambdas及其与功能指针的隐式转换。我的起始示例是将它们用作FTW功能的回调。这是预期的。 #include #include using namespace std; int…

梦断已成空 2025-02-13 10:46:49 2 0

事件使用功能指针订阅:项未评估为2个参数的函数

这是响应鼠标运动的相机类。 class Camera { public: void processMouseMovement(double xPos, double yPos) { //rotating camera } }; 移动鼠标时,…

浅笑依然 2025-02-13 06:04:30 1 0

如何访问存储函数指针返回值的结构成员的值?

我有以下结构定义: typedef struct S_t S_t; struct S_t { float *s_ptr; uint32_t ns; }; typedef struct p_t p_t; struct p_t { int32_t pID; floa…

因为看清所以看轻 2025-02-11 15:55:12 2 0

如何将void*施加到功能指针上?

我在弗雷托斯(Freertos)中使用XtaskCreate,其第四参数(void * const)是传递到新线程所调用的函数的参数。 void __connect_to_foo(void * const t…

合久必婚 2025-02-10 23:48:29 4 0

结构成员的功能指针分配导致类型铸造不匹配并最终分割故障

我编写了以下程序,以帮助我学习功能指针及其在结构中的用途: #include #include #include #include typedef struct S_t S_t; struct S_t { float *s…

氛圍 2025-02-10 21:05:15 1 0

function.prototype.bind()在C中的替代方案(不是C++)

在我的C程序中,我需要将回调功能传递给第三方库。图书馆用一些参数调用此回调。但是,我需要在此回调中曝光一个变量。该变量可以从内部的函数范围访…

浪推晚风 2025-02-10 05:48:33 3 0

从函数类型声明中推导函数参数,用于模板结构方法?

我想知道是否可以推断出返回类型,以及来自函数类型的参数定义。 我希望做类似的事情: template struct _function_wrapper_t { [return of T] call([…

油焖大侠 2025-02-09 09:42:42 5 0

我如何获取函数指针到模板类的模板方法

模板类 template class SomeServiceProxy : virtual public SomeService, virtual public SomeServiceProxyBase, virtual public _AttributeExtension…

画离情绘悲伤 2025-02-08 21:04:31 3 0

如何将一系列函数指针作为一个论点?

我有一系列函数指针 int(*oper_ptr [4])(int,int)= {add,sub,sub,mul,divi}; 对于以下功能,该功能只需在两个传递的整数上执行标准操作: in…

漆黑的白昼 2025-02-07 06:17:21 2 0

功能指针指向孩子与父母

我正在学习C ++,并且我不断遇到一个奇怪的汇编错误。我将代码简化为以下示例: #include class A { public: static A foo() { A a; return a; } }; c…

—━☆沉默づ 2025-02-06 17:55:26 2 0

SegFault传递pthread时,将另一个功能指针作为参数

我正在使用BOG标准X86-64 Ubuntu GCC,显然没有编译问题,因为我可以得到Segfault。 我正在尝试创建一个调用一个函数的pthread,该函数基于某些先前确…

要走就滚别墨迹 2025-02-06 00:34:11 4 0

为什么kfunction2在kotlin中不是可说的类型?

让我们假设我们在Kotlin中有以下类(版本1.6.21,针对JVM 17): interface Cursor( fun seekOrNext(target: String): Boolean fun seekOrPrevious(ta…

哀由 2025-02-05 11:57:24 4 0

了解将指针返回到数组的指针函数

因此,我只是想将头缠绕在“将指针返回到阵列的指针函数” ...但是要开始缓慢,我必须理解这一点: void Print(const char c){ printf("\nPrint: %c\n…

世界如花海般美丽 2025-02-04 21:12:24 2 0

C++如何创建功能包装器?

我想创建一个调用两个函数的功能包装器 t1 func1()和 t2 func2(t1)我传递并返回类型type type type t2 。这是我到目前为止得到的: #include #inc…

橙味迷妹 2025-02-04 06:32:30 2 0

上课'方法地址

我要您帮助我理解这个概念。也许我不明白,我不知道..所以我有此示例代码: #include class X{ int a; public: void do_lengthy_work(); }; void X::d…

以往的大感动 2025-02-04 04:24:05 1 0
更多

推荐作者

佚名

文章 0 评论 0

今天

文章 0 评论 0

゛时过境迁

文章 0 评论 0

达拉崩吧

文章 0 评论 0

呆萌少年

文章 0 评论 0

孤者何惧

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文