From 89ae7093aaf405d24f3d7ac0825290f2a065da99 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 7 Mar 2013 00:52:06 +0100 Subject: [PATCH] Fix virtual overloads So I learned something today: the 'using' keyword can also be used to import function names from the enclosing namespace. This not only solves the spammy virtual overload warnings that the new-fangled protocol stuff introduced unwittingly, but also removes the need to redefine RemotePeer::handle<>() as a forward to Peer::handle<>(). Also, someone please kick the C++ inventors for making method lookup not follow the Koenig rules (contrary to most other lookups...). --- src/common/remotepeer.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/common/remotepeer.h b/src/common/remotepeer.h index 5751dfb8..6c3e35f4 100644 --- a/src/common/remotepeer.h +++ b/src/common/remotepeer.h @@ -68,8 +68,8 @@ signals: protected: SignalProxy *signalProxy() const; - template - void handle(const T &protoMessage); + using Peer::handle; + using Peer::dispatch; // These protocol messages get handled internally and won't reach SignalProxy void handle(const Protocol::HeartBeat &heartBeat); @@ -89,12 +89,4 @@ private: int _lag; }; - -template inline -void RemotePeer::handle(const T &protoMessage) -{ - Peer::handle(protoMessage); -} - - #endif -- 2.20.1