move construction/assignment should be noexcept where possible
This commit is contained in:
parent
503ed940ac
commit
cf800a35da
@ -32,7 +32,7 @@ library_posix::library_posix (const std::experimental::filesystem::path &path):
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
library_posix::library_posix (library_posix &&rhs):
|
library_posix::library_posix (library_posix &&rhs) noexcept:
|
||||||
m_handle (nullptr)
|
m_handle (nullptr)
|
||||||
{
|
{
|
||||||
std::swap (m_handle, rhs.m_handle);
|
std::swap (m_handle, rhs.m_handle);
|
||||||
|
@ -26,7 +26,7 @@ namespace util {
|
|||||||
class library_posix {
|
class library_posix {
|
||||||
public:
|
public:
|
||||||
explicit library_posix (const std::experimental::filesystem::path&);
|
explicit library_posix (const std::experimental::filesystem::path&);
|
||||||
library_posix (library_posix&&);
|
library_posix (library_posix&&) noexcept;
|
||||||
~library_posix ();
|
~library_posix ();
|
||||||
|
|
||||||
library_posix (const library_posix&) = delete;
|
library_posix (const library_posix&) = delete;
|
||||||
|
@ -38,7 +38,7 @@ fd::fd (const std::experimental::filesystem::path &path, int flags, mode_t mode)
|
|||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
fd::fd (fd &&rhs):
|
fd::fd (fd &&rhs) noexcept:
|
||||||
m_fd (-1)
|
m_fd (-1)
|
||||||
{
|
{
|
||||||
std::swap (m_fd, rhs.m_fd);
|
std::swap (m_fd, rhs.m_fd);
|
||||||
@ -47,7 +47,7 @@ fd::fd (fd &&rhs):
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
fd&
|
fd&
|
||||||
fd::operator= (fd &&rhs)
|
fd::operator= (fd &&rhs) noexcept
|
||||||
{
|
{
|
||||||
close ();
|
close ();
|
||||||
std::swap (m_fd, rhs.m_fd);
|
std::swap (m_fd, rhs.m_fd);
|
||||||
|
@ -34,8 +34,8 @@ namespace util::posix {
|
|||||||
fd (const std::experimental::filesystem::path &path, int flags);
|
fd (const std::experimental::filesystem::path &path, int flags);
|
||||||
fd (const std::experimental::filesystem::path &path, int flags, mode_t);
|
fd (const std::experimental::filesystem::path &path, int flags, mode_t);
|
||||||
|
|
||||||
fd (fd &&);
|
fd (fd &&) noexcept;
|
||||||
fd& operator= (fd &&);
|
fd& operator= (fd &&) noexcept;
|
||||||
fd& operator= (int);
|
fd& operator= (int);
|
||||||
|
|
||||||
// The int constructor steals the fd. So don't pass in something that
|
// The int constructor steals the fd. So don't pass in something that
|
||||||
|
@ -42,7 +42,7 @@ map::map (size_t size, int prot, int flags, const fd &src, off_t offset):
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
map::map (map &&rhs):
|
map::map (map &&rhs) noexcept:
|
||||||
m_addr (MAP_FAILED),
|
m_addr (MAP_FAILED),
|
||||||
m_size (rhs.m_size)
|
m_size (rhs.m_size)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ map::~map ()
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
map&
|
map&
|
||||||
map::operator= (map &&rhs)
|
map::operator= (map &&rhs) noexcept
|
||||||
{
|
{
|
||||||
std::swap (m_addr, rhs.m_addr);
|
std::swap (m_addr, rhs.m_addr);
|
||||||
std::swap (m_size, rhs.m_size);
|
std::swap (m_size, rhs.m_size);
|
||||||
|
@ -27,14 +27,14 @@ namespace util::posix {
|
|||||||
class map {
|
class map {
|
||||||
public:
|
public:
|
||||||
map (const map&) = delete;
|
map (const map&) = delete;
|
||||||
map (map&&);
|
map (map&&) noexcept;
|
||||||
|
|
||||||
map (size_t size, int prot, int flags);
|
map (size_t size, int prot, int flags);
|
||||||
map (size_t size, int prot, int flags, const fd&, off_t offset = 0);
|
map (size_t size, int prot, int flags, const fd&, off_t offset = 0);
|
||||||
~map ();
|
~map ();
|
||||||
|
|
||||||
map& operator= (const map&) = delete;
|
map& operator= (const map&) = delete;
|
||||||
map& operator= (map&&);
|
map& operator= (map&&) noexcept;
|
||||||
|
|
||||||
uint8_t* begin (void);
|
uint8_t* begin (void);
|
||||||
uint8_t* end (void);
|
uint8_t* end (void);
|
||||||
|
@ -120,14 +120,14 @@ socket::~socket ()
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
socket::socket (socket &&rhs):
|
socket::socket (socket &&rhs) noexcept:
|
||||||
fd (std::move (rhs))
|
fd (std::move (rhs))
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class socket&
|
class socket&
|
||||||
socket::operator= (socket &&rhs)
|
socket::operator= (socket &&rhs) noexcept
|
||||||
{
|
{
|
||||||
fd::operator= (std::move (rhs));
|
fd::operator= (std::move (rhs));
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -38,8 +38,8 @@ namespace util::posix {
|
|||||||
socket (const socket&) = delete;
|
socket (const socket&) = delete;
|
||||||
socket& operator= (const socket&) = delete;
|
socket& operator= (const socket&) = delete;
|
||||||
|
|
||||||
socket (socket &&rhs);
|
socket (socket &&rhs) noexcept;
|
||||||
socket& operator= (socket &&);
|
socket& operator= (socket &&) noexcept;
|
||||||
|
|
||||||
// the destructor is provided so that we can operate more cleanly on
|
// the destructor is provided so that we can operate more cleanly on
|
||||||
// win32 where we must call closesocket instead of the normal close.
|
// win32 where we must call closesocket instead of the normal close.
|
||||||
|
@ -28,7 +28,7 @@ spinlock::spinlock ():
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
spinlock::spinlock (spinlock &&rhs):
|
spinlock::spinlock (spinlock &&rhs) noexcept:
|
||||||
held (rhs.held.load ())
|
held (rhs.held.load ())
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ namespace util::thread {
|
|||||||
class spinlock {
|
class spinlock {
|
||||||
public:
|
public:
|
||||||
spinlock ();
|
spinlock ();
|
||||||
spinlock (spinlock &&);
|
spinlock (spinlock &&) noexcept;
|
||||||
spinlock& operator= (spinlock &&);
|
spinlock& operator= (spinlock &&) noexcept;
|
||||||
|
|
||||||
spinlock (const spinlock&) = delete;
|
spinlock (const spinlock&) = delete;
|
||||||
spinlock& operator= (const spinlock&) = delete;
|
spinlock& operator= (const spinlock&) = delete;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user