Support arbitrary return type in closure for member function pointer.

This commit is contained in:
John Maguire 2012-12-13 16:55:23 +01:00
parent 020f08438f
commit 195e1cb2ad
2 changed files with 4 additions and 3 deletions

View File

@ -213,11 +213,11 @@ _detail::ClosureBase* NewClosure(
return NewClosure(sender, signal, boost::bind(callback, args...)); return NewClosure(sender, signal, boost::bind(callback, args...));
} }
template <typename T, typename... Args> template <typename T, typename Unused, typename... Args>
_detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure(
QObject* sender, QObject* sender,
const char* signal, const char* signal,
T* receiver, void (T::*callback)(Args...), T* receiver, Unused (T::*callback)(Args...),
const Args&... args) { const Args&... args) {
return NewClosure(sender, signal, boost::bind(callback, receiver, args...)); return NewClosure(sender, signal, boost::bind(callback, receiver, args...));
} }

View File

@ -107,8 +107,9 @@ namespace {
class Bar { class Bar {
public: public:
explicit Bar(int a) : foo_(a) {} explicit Bar(int a) : foo_(a) {}
void Foo(int* answer) { bool Foo(int* answer) {
*answer = foo_; *answer = foo_;
return true;
} }
private: private: