Use references instead of raw pointer, to store the “parent” object

In Bridge and IrcClient
This commit is contained in:
Florent Le Coz
2015-12-21 14:51:26 +01:00
parent 8ddbe8d3e6
commit 7e2427148e
5 changed files with 75 additions and 77 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ public:
explicit IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname,
const std::string& nickname, const std::string& username,
const std::string& realname, const std::string& user_hostname,
Bridge* bridge);
Bridge& bridge);
~IrcClient();
/**
* Connect to the IRC server
@@ -281,9 +281,9 @@ private:
*/
std::string current_nick;
/**
* Raw pointer because the bridge owns us.
* To communicate back with the bridge
*/
Bridge* bridge;
Bridge& bridge;
/**
* The list of joined channels, indexed by name
*/