diff options
author | Remko Tronçon <git@el-tramo.be> | 2013-09-16 20:16:37 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2013-09-17 18:25:40 (GMT) |
commit | 4a8cf892743284265bcc8bf9c6fbc4747aa86089 (patch) | |
tree | ff223fa5638790d9f0643ddf8baf8c50f68f3186 | |
parent | 56a3f51b12b4fc2328cb76be58d623eb5a1f63e4 (diff) | |
download | swift-4a8cf892743284265bcc8bf9c6fbc4747aa86089.zip swift-4a8cf892743284265bcc8bf9c6fbc4747aa86089.tar.bz2 |
Don't use implicit bool conversion on shared_ptr
C++11 doesn't have implicit conversion to bool on shared_ptr.
The cleanest fix is to compare against nullptr, but this only
works on C++11.
Change-Id: Ia2b4b5d90f99aa24c4f3bdf0d680343754e32ec2
-rw-r--r-- | Swiften/Client/ClientSession.h | 4 | ||||
-rw-r--r-- | Swiften/Elements/Message.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index 6ef624e..4b944fc 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -94,7 +94,9 @@ namespace Swift { bool getStreamManagementEnabled() const { - return stanzaAckRequester_; + // Explicitly convert to bool. In C++11, it would be cleaner to + // compare to nullptr. + return static_cast<bool>(stanzaAckRequester_); } bool getRosterVersioningSupported() const { diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index 3b9145c..ea99814 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -38,8 +38,10 @@ namespace Swift { updatePayload(boost::make_shared<Subject>(subject)); } + // Explicitly convert to bool. In C++11, it would be cleaner to + // compare to nullptr. bool hasSubject() { - return getPayload<Subject>(); + return static_cast<bool>(getPayload<Subject>()); } std::string getBody() const { |