忽略引用函数参数(Ignore reference function argument)
我有这个签名的功能(我不能编辑它):
void foo(int a,int b, int& c);我想打电话给它,但我不在乎获取c。 目前我这样做:
int temp; foo(5,4,temp); //temp never used again我的解决方案似乎愚蠢。 忽略这个论点的标准方法是什么?
I have function with this signature (I can not edit it):
void foo(int a,int b, int& c);I want to call it but I do not care about the getting c. Currently I do this:
int temp; foo(5,4,temp); //temp never used againMy solution seems dumb. What is the standard way to ignore this argument.
最满意答案
空无一人。
如果你的担心主要是用临时存在的一个包装函数来污染你的当前堆栈......就像:
void foo_wrapper(int a, int b) { int temp; foo(a, b, temp); }应该就够了。
There is none.
If your concern is primarily one of polluting your current stack with the presence of temp, a wrapper function... like:
void foo_wrapper(int a, int b) { int temp; foo(a, b, temp); }should suffice.
更多推荐
发布评论