[英]C++ Boost function comparison
I have a class which contains boost::function as one of its arguments. 我有一个类,其中包含boost :: function作为其参数之一。 I have to make this class equality comparable but the boost::function is not equality comparable. 我必须使这个类平等可比,但boost :: function不是可比性的。 Is there a easy workaround for this problem? 这个问题有一个简单的解决方法吗?
Thanks, Gokul. 谢谢,Gokul。
boost::function is not eq_compare because there is good way to handle the fact that many functors are not eq_compare. boost :: function不是eq_compare,因为有很好的方法可以处理许多仿函数不是eq_compare的事实。 Here is a bit of insight into it: http://www.boost.org/doc/libs/1_35_0/doc/html/function/faq.html#id690470 以下是对它的一些见解: http : //www.boost.org/doc/libs/1_35_0/doc/html/function/faq.html#id690470
Unfortunately, the boosties decided not to provide a policy-based approach which would allow us to select the alternative, ie "eq-comparable functors only or bust" implementation, leaving us a bit stuffed here. 不幸的是,提升决定不提供基于政策的方法,这将允许我们选择替代方案,即“仅具有可比较的仿函数或破坏”的实现,让我们在这里留下一些东西。 There might be a couple of crappy workarounds for this situation but I'd suggest to either: 对于这种情况可能会有一些糟糕的变通办法,但我建议:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.