From 3689b6933d37b91a07ced8e64172d38be876b4ba Mon Sep 17 00:00:00 2001 From: "Darryl L. Pierce" Date: Tue, 12 Feb 2013 19:26:13 +0000 Subject: QPID-4579: Fixes building Qpid under the latest GCC (4.8.0). Moves the definition of Functor and MemFuncRef out of Handler class definition. Fixes the build failure in later versions of GCC. Contributed by: Petr Machata git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1445322 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/Handler.h | 43 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/framing/Handler.h b/cpp/src/qpid/framing/Handler.h index fa8db36f49..e0c0e59d09 100644 --- a/cpp/src/qpid/framing/Handler.h +++ b/cpp/src/qpid/framing/Handler.h @@ -49,29 +49,12 @@ struct Handler { * Functor(f) will copy f. * Functor(f) will only take a reference to x. */ - template class Functor : public Handler { - public: - Functor(F f, Handler* next=0) : Handler(next), functor(f) {} - void handle(T t) { functor(t); } - private: - F functor; - }; + template class Functor; /** Adapt a member function of X as a Handler. * Only holds a reference to its target, not a copy. */ - template - class MemFunRef : public Handler { - public: - MemFunRef(X& x, Handler* next=0) : Handler(next), target(&x) {} - void handle(T t) { (target->*F)(t); } - - /** Allow calling with -> syntax */ - MemFunRef* operator->() { return this; } - - private: - X* target; - }; + template class MemFunRef; /** Interface for a handler that implements a * pair of in/out handle operations. @@ -94,7 +77,29 @@ struct Handler { }; }; +template +template +class Handler::Functor : public Handler { + public: + Functor(F f, Handler* next=0) : Handler(next), functor(f) {} + void handle(T t) { functor(t); } + private: + F functor; +}; + +template +template +class Handler::MemFunRef : public Handler { + public: + MemFunRef(X& x, Handler* next=0) : Handler(next), target(&x) {} + void handle(T t) { (target->*F)(t); } + + /** Allow calling with -> syntax */ + MemFunRef* operator->() { return this; } + private: + X* target; +}; }} #endif /*!QPID_FRAMING_HANDLER_H*/ -- cgit v1.2.1