我可以写一个fn参考吗? [英] Can I write a fn reference?
本文介绍了我可以写一个fn参考吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以写:int&(& fn)(int& arg);?谢谢!!!
Is it possible to write: int&(&fn)(int& arg);? Thanks!!!
推荐答案
Protoman写道:
Protoman wrote:
是否可以写:int&(& ; fn)(int& arg);?谢谢!!!
Is it possible to write: int&(&fn)(int& arg);? Thanks!!!
是的,你刚才......
Yes, you just have...
Protoman写道:
Protoman wrote:
是否可以写:int&(& fn)(int& arg);?谢谢!!!
Is it possible to write: int&(&fn)(int& arg);? Thanks!!!
是的。
V
Yes.
V
Protoman写道:
Protoman wrote:
是否可以写:int&(& fn)(int& arg);?谢谢!!!
Is it possible to write: int&(&fn)(int& arg);? Thanks!!!
不可能。
参考需要在定义时初始化。你的表达结束于
a分号,这将给出非初始化错误。
你可以这样做 -
INT和放大器; foo(int& x);
int&(& fn)(int& arg)= foo;
这将有效。
No its not possible.
References need to be initialized when defined. Your expression ends in
a semicolon which will give non-initialization error.
You can do this -
int& foo(int & x);
int&(&fn)(int& arg) = foo;
This will work.
这篇关于我可以写一个fn参考吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文