[英]Check if two std::function are Equal
If I have two std::function
s, how can I check whether both hold the same function or not? 如果我有两个std::function
,如何检查它们是否都具有相同的功能?
Additional Information: I have a vector of functions std::vector<std::function<void()>>
and before adding another function to the vector I want to check if it already is contained. 附加信息:我有一个向量std::vector<std::function<void()>>
的向量,在向该向量添加另一个函数之前,我想检查它是否已包含。
通常std::function
和boost::function
是不可比较的,因为它们需要它们的存储对象是可比较的,但并非所有功能对象都一样,而且lambda都具有operator==
因此std
或boost
函数无法对其进行比较
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.