C++: implement missing copy operator

It's good practice to implement the copy operator, even if not needed
at the moment.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
Patrick Ohly 2017-12-13 00:59:53 -08:00
parent 11e5e94ac2
commit bd6adff9a5
3 changed files with 14 additions and 0 deletions

View file

@ -146,6 +146,12 @@ class IndividualDataCompare : public std::binary_function<IndividualData, Indivi
{
return m_compare->compare(a.m_criteria, b.m_criteria);
}
IndividualDataCompare & operator = (const IndividualDataCompare &other)
{
m_compare = other.m_compare;
return *this;
}
};
/**

View file

@ -197,6 +197,13 @@ class DBusConnectionPtr : public boost::intrusive_ptr<GDBusConnection>
m_name(other.m_name)
{}
DBusConnectionPtr & operator = (const DBusConnectionPtr &other)
{
*static_cast<boost::intrusive_ptr<GDBusConnection> *>(this) = static_cast<const boost::intrusive_ptr<GDBusConnection> &>(other);
m_name = other.m_name;
return *this;
}
GDBusConnection *reference(void) throw()
{
GDBusConnection *conn = get();

View file

@ -363,6 +363,7 @@ template<class T> class Init {
Init() : m_value(boost::value_initialized<T>()) {}
Init(const Init &other) : m_value(other.m_value) {}
Init & operator = (const T &val) { m_value = val; return *this; }
Init & operator = (const Init &other) { m_value = other.m_value; return *this; }
operator const T & () const { return m_value; }
operator T & () { return m_value; }
private: