compilation: fix boost::shared_ptr->bool issue under C++14

The implicit conversion of boost::shared_ptr->bool is no
longer supported when compiling as C++14 (the default under
gcc 6). We have to cast explicitly.

Fixes errors like this:

Logging.h:258:41: error: cannot convert 'const boost::shared_ptr<SyncEvo::Logger>' to 'bool' in return
         operator bool () const { return m_logger; }
This commit is contained in:
Patrick Ohly 2016-08-26 11:12:49 -07:00
parent 4e2dd07580
commit 3299613591
3 changed files with 3 additions and 3 deletions

View File

@ -425,7 +425,7 @@ public:
void setServerAlerted(bool serverAlerted) { m_serverAlerted = serverAlerted; }
void initServer(SharedBuffer data, const std::string &messageType);
void setStubConnection(const boost::shared_ptr<Connection> c) { m_connection = c; m_useConnection = c; }
void setStubConnection(const boost::shared_ptr<Connection> c) { m_connection = c; m_useConnection = static_cast<bool>(c); }
boost::weak_ptr<Connection> getStubConnection() { return m_connection; }
bool useStubConnection() { return m_useConnection; }

View File

@ -255,7 +255,7 @@ class Logger
Handle &operator = (const Handle &other) throw ();
~Handle() throw ();
operator bool () const { return m_logger; }
operator bool () const { return static_cast<bool>(m_logger); }
bool operator == (Logger *logger) const { return m_logger.get() == logger; }
Logger *get() const { return m_logger.get(); }

View File

@ -53,7 +53,7 @@ class StringDataBlob : public DataBlob
virtual boost::shared_ptr<std::string> getData() { return m_data; }
virtual std::string getName() const { return m_name; }
virtual bool exists() const { return m_data; }
virtual bool exists() const { return static_cast<bool>(m_data); }
virtual bool isReadonly() const { return m_readonly; }
};