0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-13 03:00:31 +00:00
termux-packages/packages/boost/boost-function-support-fn.contains_f_-where-f-is-a-function.patch
2023-10-01 00:46:19 +08:00

42 lines
1.3 KiB
Diff

https://github.com/boostorg/function/commit/7ca2310b15e387258e97e4cd16887f5ee4906b28
--- a/boost/function/function_base.hpp
+++ b/boost/function/function_base.hpp
@@ -25,6 +25,7 @@
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/enable_if.hpp>
#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/is_function.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
@@ -652,7 +653,8 @@ class function_base
}
template<typename F>
- bool contains(const F& f) const
+ typename boost::enable_if_< !boost::is_function<F>::value, bool >::type
+ contains(const F& f) const
{
if (const F* fp = this->template target<F>())
{
@@ -662,6 +664,19 @@ class function_base
}
}
+ template<typename Fn>
+ typename boost::enable_if_< boost::is_function<Fn>::value, bool >::type
+ contains(Fn& f) const
+ {
+ typedef Fn* F;
+ if (const F* fp = this->template target<F>())
+ {
+ return function_equal(*fp, &f);
+ } else {
+ return false;
+ }
+ }
+
#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3
// GCC 3.3 and newer cannot copy with the global operator==, due to
// problems with instantiation of function return types before it