operator()有什么用? [英] What's the use of operator()?

查看:109
本文介绍了operator()有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习C ++并且似乎找不到运算符()的理由?

这对任何事情都有好处吗? (除了操作指向函数的指针 -

无论如何都是C标准的一部分。)


任何人都知道在哪里可以找到关于此运算符的教程?我似乎无法在网上找到任何



谢谢,


- Olumide

I''m studying C++ and cant seem to find much justification for operator()?
Is it good for anything? (beyond manipulating pointers to functions -
which are part of the C standard anyway.)

Anyone know where can I find tutorials on this operator? I cant seem to
find any online.

Thanks,

- Olumide

推荐答案



" Olumide" < 50 *** @ web.de> schrieb im Newsbeitrag

news:46 ****************************** @ localhost.ta lkaboutprogramming。 com ...

"Olumide" <50***@web.de> schrieb im Newsbeitrag
news:46******************************@localhost.ta lkaboutprogramming.com...
我正在学习C ++并且似乎找不到
operator()的理由?
对任何事情都有好处吗? (除了操作指向
函数的指针 -
,无论如何都是C标准的一部分。)

任何人都知道在哪里可以找到关于此运算符的教程?我似乎无法在网上找到任何内容。
I''m studying C++ and cant seem to find much justification for
operator()?
Is it good for anything? (beyond manipulating pointers to
functions -
which are part of the C standard anyway.)

Anyone know where can I find tutorials on this operator? I cant seem
to
find any online.




我通常使用(a,b)而不是创建[] []运算符运算符。

所以这样我每个大括号只需要一个类而不是n。

看一下boost'的灵魂解析器库。他们使用所有运算符

如此夸张,你用它写了一些代码

之后你甚至不知道它是C ++。

-Gernot



Instead of creating a [][] operator I usually use the (a,b) operator.
So this way I only need one class instead of n for each brace.
Take a look at boost''s spirit parser library. They use all operators
so exesively, you don''t even know it''s C++ after you wrote some code
with it.
-Gernot


谢谢Gernot。有链接吗?我只是一个学到的东西。


- Olumide -

Thanks Gernot. Got any links? I''m just a learning you see.

- Olumide -


" Olumide" < 50 *** @ web.de>在消息中写道

news:46 ****************************** @ localhost.ta lkaboutprogramming。 com ...
"Olumide" <50***@web.de> wrote in message
news:46******************************@localhost.ta lkaboutprogramming.com...
我正在学习C ++并且似乎找不到运算符()的理由?
它对任何事情都有好处吗? (除了操作指向函数的指针 -
,无论如何都是C标准的一部分。)
I''m studying C++ and cant seem to find much justification for operator()?
Is it good for anything? (beyond manipulating pointers to functions -
which are part of the C standard anyway.)




您可以使用它们来创建仿函数,STL广泛地使用它们。


-

不可原谅



You can use them to create functors, which the STL does extensively.

--
Unforgiven


这篇关于operator()有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆