手机版
热门标签
站点地图
我要投稿
广告合作
联系我们
搜 索
广告位招租
广告位招租
切换导航
首页
人工智能
编程教程
编程导航
编程百科
编程问答
编程博文
编程实例
硬件设备
网络运营
软件教程
移动数码
办公软件
操作系统
网络运维
技术频道
▸ 编程语言
▸ 前端开发
▸ 移动开发
▸ 开发工具
▸ 程序设计
▸ 行业应用
▸ CMS系统
▸ 服务器
▸ 数据库
公众号推荐
微信公众号搜
"智元新知"
关注
微信扫一扫可直接关注哦!
function-pointers
function-pointers专题提供function-pointers的最新资讯内容,帮你更好的了解function-pointers。
C类成员指向全局函数的指针
我希望有一个类作为成员指向函数的指针 这是函数指针: typedef double (*Function)(double); 这是一个适合函数指针定义的函数: double f1(double x) { return 0; } 这是课堂定义: class IntegrFunction { public: Function* function; }; 在主要功能的某个地方,我想做这样
作者:佚名 时间:2019-05-15
typedef如何将函数指向自己的类型作为参数?
示例:一个函数需要一个函数(它接受一个函数(即…)和一个int)和一个int. typedef void(*Func)(void (*)(void (*)(...), int), int); 它会递归地爆炸(…).有没有根本的原因,这不可能做,还是有另一种语法?在我看来,应该是可能的,没有演员.我真的想通过一个调度表,但如果我可以通过这一种类型,我可以弄清楚. 您可以将函数指针包装在一个结构体中:
作者:佚名 时间:2019-05-13
是否有一种惯用的方法来在C中创建委托集合?
我想在集合中存储具有类似签名的函数,以执行以下操作: f(vector<Order>& orders, vector<Function>& functions) { foreach(process_orders in functions) process_orders(orders); } 我想到了函数指针: void GiveCoolOrdersToBob(Order); void Gi
作者:佚名 时间:2019-05-07
功能地图c
我已经做了一个功能的地图.所有这些函数都是void并接收单个字符串参数. 码: void f1(string params){...} void f2(string params){...} void f3(string params){...} map<string , void*> funcMap; funcMap["f1"] =(void*)&f1; funcMap["f2"] =(vo
作者:佚名 时间:2019-05-07
C:函数指针和typedef问题
我有一个C函数,它将一个函数指针作为参数,它是一个析构函数,我将在程序结束时调用它.这是我的功能的原型: int store_dest(void (*routine)(void *)); 我想将这个函数指针存储到一些其他信息的结构中.为了有一个漂亮的结构,我想要一个typedef这个函数指针.这是我的typedef: typedef void (*my_destructor)(void *); 这
作者:佚名 时间:2019-05-07
c – 成员函数的std :: async调用
考虑以下课程: class Foo { private: void bar(const size_t); public: void foo(); }; 现在Foo :: foo()应该启动执行bar的线程,所以这就是它的实现方式: void Foo:foo() { auto handle = std::async(std::launch::async,
作者:佚名 时间:2019-05-07
c – 指向成员表示的指针
我试图从成员函数做一些回调,一切都ok,直到我尝试使用派生自2类的模板类作为回调对象,当我收到以下错误: error C2440: 'reinterpret_cast' : Pointers to members have different representations; cannot cast between them 这个东西告诉我,成员函数指针有不同的表示(doh!) 这些表示是什么?他
作者:佚名 时间:2019-05-07
为什么在初始化一个函数指针数组时有一个“警告”?
我尝试初始化一个数组的函数指针,我有“警告”: ring-buffer.c:57:19: warning: assignment from incompatible pointer type [enabled by default] RBufP->rbfunc[0] = &RBufPush; ^ 但邻里的确定: /*typedef for func pointer
作者:佚名 时间:2019-05-07
如何在不使用C中的typedef的情况下声明一个返回指向函数的函数的函数,该函数返回函数指针?
我想知道如何编写一个函数,它返回一个指向函数的指针,该函数返回一个没有typedef的函数指针.例如,返回函数指针的函数可以定义为: type (*f_name(..))(..){..} 所以这会返回一个指向返回’type’的函数的指针,现在如果’type’是一个函数指针,你如何声明该函数.但由于我的主管不想使用typedef,我无法使用它们. 谢谢你提供的所有帮助. 对于这样的问题,有一个叫做c
作者:佚名 时间:2019-05-05
c – 通过网络发送指向静态功能的指针是否安全?
我正在考虑一些我必须在C中实现的RPC代码,我想知道将它通过网络发送到相同的二进制代码是否安全(以及在哪些假设下)(假设它完全相同并且它们在同一个二进制代码上运行)建筑).我猜虚拟内存在这里应该有所不同. 我只是出于好奇而问它,因为它在任何情况下都是一个糟糕的设计,但我想知道它是否在理论上是可行的(如果它可以扩展到除了程序可能包含的函数之外的其他类型的静态数据指针). 一般来说,由于很多原因它并不
作者:佚名 时间:2019-05-05
c – int(int,int)样式模板函数类型语法
我记得当使用Boost.Spirit和std :: function添加到C 0x时,你可以使用不使用指针的语法指定函数类型,比如定义std :: function< bool(int)> fn,而你会抛出像(bool(*)(int))fn这样的指针. 谁能告诉我这个新语法的名称或对此的任何引用,或如何使用它?它看起来像一个多态函数类型语法也适用于仿函数,但我真的不知道如何使用它. bool(in
作者:佚名 时间:2019-05-02
函数指针typedef的前向声明
我遇到了一个特殊的问题.最好只是向您展示我正在尝试做什么,然后解释它. typedef void functionPointerType ( struct_A * sA ); typedef struct { functionPointerType ** functionPointerTable; }struct_A; 基本上,我有一个结构struct_A,其中包含一个指向函数指针表的指
作者:佚名 时间:2019-04-27
c – 将intptr_t传递给期望int的函数是否安全?
更具体地说,如果我有以下函数指针类型: typedef void (*callback_type) (intptr_t context, void* buffer, size_t count); 我可以安全地,没有“未定义的行为”做: callback_type func_ptr = (callback_type)write; intptr_t context = fd; func_ptr(co
作者:佚名 时间:2019-04-27
c – 如何定义一般的成员函数指针
我创建了一个Timer类,当定时器到期时,它必须调用回调方法.目前我正在使用正常的函数指针(它们被声明为void(*)(void),当Elapsed事件发生时,函数指针被调用. 有可能使用还具有签名void(AnyClass :: *)(void)的成员函数做同样的事情? 谢谢你们 编辑:此代码必须在Windows上工作,也可以在实时操作系统(VxWorks)上运行,因此不使用外部库将是巨大的.
作者:佚名 时间:2019-04-27
c – 错误C2823:typedef模板是非法的 – 函数指针
我想使用模板定义函数指针类型.但是,VS 2013我认为’typedef模板是非法的’. 我想写这样的东西: template<typename SD> typedef void(*FuncPtr)(void *object, SD *data); 不幸的是,这不编译.我想保持这个简短的事情.基本上我需要为函数指针定义一个类型,其参数是一个模板类. 从C 11开始,你可以使用using关键字作为非
作者:佚名 时间:2019-04-25
如果我们增加函数指针会发生什么
递增整数指针将按整数的大小增加地址. 如果我们增加一个函数指针会发生什么? 与void *指针和指向不完整类型的指针一样,在函数指针上不允许使用算术运算. 例如,关于加法运算符的C99§6.5.6说: For addition, either both operands shall have arithmetic type, or one operand shall be a pointer to
作者:佚名 时间:2019-04-25
如何将另一个函数返回的函数分配给函数变量?结果而不是生成函数本身
函数返回一个匿名函数.我想将结果分配给一个变量.但编译器认为我正在尝试分配函数而不是函数的结果.我该如何解决? program Project9; {$APPTYPE CONSOLE} type TMyEvent = reference to function: string; var v1: TMyEvent; function GetHandler: TMyEvent; beg
作者:佚名 时间:2020-03-22
delphi – 如何获取方法指针指向的方法的名称?
我已经定义了以下内容: >一个方法指针,如果验证正常或错误代码则返回0 TValidationFunc = Function(AParam: TAnObject): integer Of Object; >要执行的功能列表: Functions: TObjectList < TValidationFunc>; 我在函数列表中放了几个带有此签名的函数. 为了执行它们,我执行: For valid I
作者:佚名 时间:2019-06-17
上一页
6
7
8
9
10
11
12
13
14
下一页
小编推荐
苹果市值2025年有望达4万亿美元
• 联想拯救者新一代Y700平板通过IMDA认证
• 最新AI生图模型Flux1.1刷屏!添加单反相
• 联发科天玑 9400 频率敲定,3.626GHz 最
• 苹果新品发布会来了!5款产品面临停产
• 佳能R5C Mark II配置曝光:双系统设计,
• AI应用的东风,奥特曼不想错过
• 为新品让路!苹果定制版Mac发货延期
热门标签
更多
python
JavaScript
java
HTML
PHP
reactjs
C#
Android
CSS
Node.js
sql
r
python-3.x
MysqL
jQuery
c++
pandas
Flutter
angular
IOS
django
linux
swift
typescript
路由器
JSON
路由器设置
无线路由器
h3c
华三
华三路由器设置
华三路由器
电脑软件教程
arrays
docker
软件图文教程
C
vue.js
laravel
spring-boot