Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在这里阅读了“functionoids”的描述。它们看起来像是 Boost::function 和 Boost::bind 的穷人版本。我错过了什么吗?如果您已经在使用 Boost,是否有充分的理由使用它们?
我投票给 tr1::function。
函子或函子代表tr1/boost::function进化的基础。公共接口函子的限制是它们打破了 OO 范式,因为它们代表不同的类型并且只能传递给模板函数(除非您提供它们派生自的基类)。
tr1/boost::function
事实上,通过类型擦除技术 tr1::function克服了这个限制:它们最好用于实现动态策略类。
tr1::function
不。
或者在此处查看 FQA 答案。