Steven Watanabe wrote:
But the compiler (GCC 4.1.2) complains:
error: no matching function for call to 'neg(<unresolved overloaded function type>)'
What's the problem. And, also, what's the solution? :-)
Internal to the compiler, the type of is<int> is a special type used to flag overloads. (unresolved overloaded function type). The problem is that you are passing this special type to a function template (the boost::function constructor) which does not provide enough information to resolve the overloading.
Maybe I misunderstand your explanation. But I'm not sure if is<int> has anything to do with the problem. As a test I tried the following: bool foo(int a) { return a == 1; } ... BOOST_CHECK_PREDICATE( neg(foo), (2) ); Which gives a similar (though less unresolved) error-message: error: no matching function for call to 'neg(bool (&)(int))'
The solution is to add a cast: static_cast
Hm. That's not exactly pretty. I'd rather use boost::bind itself on the call site. I was hoping to be able to fix something in the definition of neg instead. -- Michiel Helvensteijn