pool: add move constructor
This commit is contained in:
parent
32e06e889e
commit
ab0bb60602
20
pool.hpp
20
pool.hpp
@ -3,7 +3,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright 2011-2016 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2011-2019 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -50,7 +50,23 @@ namespace cruft {
|
|||||||
pool (const pool&) = delete;
|
pool (const pool&) = delete;
|
||||||
pool& operator= (const pool&) = delete;
|
pool& operator= (const pool&) = delete;
|
||||||
|
|
||||||
pool (pool&&) noexcept;
|
pool (pool &&rhs) noexcept
|
||||||
|
: m_head (nullptr)
|
||||||
|
, m_next (nullptr)
|
||||||
|
, m_capacity (0)
|
||||||
|
, m_size (0)
|
||||||
|
{
|
||||||
|
std::swap (m_head, rhs.m_head);
|
||||||
|
|
||||||
|
m_next = rhs.m_next.load ();
|
||||||
|
rhs.m_next = nullptr;
|
||||||
|
|
||||||
|
std::swap (m_capacity, rhs.m_capacity);
|
||||||
|
|
||||||
|
m_size = rhs.m_size.load ();
|
||||||
|
rhs.m_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pool& operator= (pool&&);
|
pool& operator= (pool&&);
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
|
Loading…
Reference in New Issue
Block a user