Add missing operator=(Connection&&)

The move assignment should also be defined if the move construction is
defined.
This commit is contained in:
Markus Mäkelä 2020-05-11 07:43:59 +03:00
parent b212117fd3
commit 481f6f1aea
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -276,17 +276,30 @@ public:
}
Connection(Connection&& rhs)
: m_host(rhs.m_host)
, m_port(rhs.m_port)
, m_user(rhs.m_user)
, m_pw(rhs.m_pw)
, m_db(rhs.m_db)
, m_ssl(rhs.m_ssl)
, m_conn(rhs.m_conn)
: m_host(std::move(rhs.m_host))
, m_port(std::move(rhs.m_port))
, m_user(std::move(rhs.m_user))
, m_pw(std::move(rhs.m_pw))
, m_db(std::move(rhs.m_db))
, m_ssl(std::move(rhs.m_ssl))
, m_conn(std::move(rhs.m_conn))
{
rhs.m_conn = nullptr;
}
Connection& operator=(Connection&& rhs)
{
m_host = std::move(rhs.m_host);
m_port = std::move(rhs.m_port);
m_user = std::move(rhs.m_user);
m_pw = std::move(rhs.m_pw);
m_db = std::move(rhs.m_db);
m_ssl = std::move(rhs.m_ssl);
m_conn = std::move(rhs.m_conn);
rhs.m_conn = nullptr;
return *this;
}
virtual ~Connection()
{
mysql_close(m_conn);