some c++11 support

This commit is contained in:
Arvid Norberg 2013-12-17 00:51:01 +00:00
parent 60a33f8cf8
commit 91c622bec0
2 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,11 @@ namespace libtorrent
bitfield(bitfield const& rhs): m_bytes(0), m_size(0), m_own(false) bitfield(bitfield const& rhs): m_bytes(0), m_size(0), m_own(false)
{ assign(rhs.bytes(), rhs.size()); } { assign(rhs.bytes(), rhs.size()); }
#if __cplusplus > 199711L
bitfield(bitfield&& rhs): m_bytes(rhs.m_bytes), m_size(rhs.m_size), m_own(rhs.m_own)
{ rhs.m_bytes = NULL; }
#endif
// assigns a bitfield pointed to ``b`` of ``bits`` number of bits, without // assigns a bitfield pointed to ``b`` of ``bits`` number of bits, without
// taking ownership of the buffer. This is a way to avoid copying data and // taking ownership of the buffer. This is a way to avoid copying data and
// yet provide a raw buffer to functions that may operate on the bitfield // yet provide a raw buffer to functions that may operate on the bitfield

View File

@ -114,6 +114,11 @@ public:
std::memcpy(m_begin, b.begin(), b.size()); std::memcpy(m_begin, b.begin(), b.size());
} }
#if __cplusplus > 199711L
buffer(buffer&& b): m_begin(b.m_begin), m_end(b.m_end), m_last(b.m_last)
{ b.m_begin = b.m_end = b.m_last = NULL; }
#endif
buffer& operator=(buffer const& b) buffer& operator=(buffer const& b)
{ {
if (&b == this) return *this; if (&b == this) return *this;