本文介绍了函数对象与函数指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于诸如回调,从列表中选择功能

以及其他东西,函数对象或函数指针这样的东西更有效?

谢谢!!!

Which is more efficient for stuff like callbacks, selecting a funct
from a list, and other stuff, function objects or function pointers?
Thanks!!!

推荐答案




红色的,显然是在561行。 br />

如果你对一个认真的答案感兴趣,那么在你问之前你必须自己做这件事吗?b b b b b b b b b b b b b要点:


*以可衡量的方式定义效率(例如运行时间,

内存消耗,开发时间,开发成本......)。


*定义你感兴趣的案例。


*定义你感兴趣的平台。


*创建和/ o确定测试程序。


*测量。


其他任何事情都是关于假设案例的纯粹推测。


但首先,请记住(或在你的耳后)


过早优化是所有邪恶的根源。


优化总是一种权衡,这意味着你可以交易一些东西,

,通常是可维护性和正确性。


-

答:因为它弄乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门帖子。

问:usenet和电子邮件中最烦人的事情是什么?



The red one, obviously, at line 561.

If you''re interested in a serious answer you''ll have to do the work
yourself before asking, so then there''s not much point in asking:

* Define efficiency in a measurable way (e.g. running time,
memory consumption, development time, development cost, ...).

* Define the cases you''re interested in.

* Define the platforms you''re interested in.

* Create and/or identify test programs.

* Measure.

Anything else is pure speculation about hypothetical cases.

But first of all, keep at heart (or behind your ear) that

Premature optimization is the root of all evil.

Optimization is always a trade-off, meaning you trade away something,
and usually that something is maintainability and correctness.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?




这篇关于函数对象与函数指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 11:01