Memory streams - Move constructor for T_MemoryOutputStream

This commit is contained in:
Emmanuel BENOîT 2020-03-08 13:12:43 +01:00
parent a4a2a9eda4
commit 90cf63c592
2 changed files with 13 additions and 0 deletions

View file

@ -47,6 +47,7 @@ class T_MemoryOutputStream final : public A_OutputStream
T_MemoryOutputStream( ) = delete;
T_MemoryOutputStream( void* buffer , size_t size , F_Resizer resizer = nullptr );
T_MemoryOutputStream( T_MemoryOutputStream&& source ) noexcept;
template< int S , typename T >
explicit T_MemoryOutputStream( T_FixedBuffer< S , T >& buffer );

View file

@ -39,6 +39,18 @@ T_MemoryOutputStream::T_MemoryOutputStream( void* buffer , size_t size , F_Resiz
{ }
T_MemoryOutputStream::T_MemoryOutputStream(
T_MemoryOutputStream&& other ) noexcept
: A_OutputStream( other.position_ , other.size_ ) ,
buffer_{ other.buffer_ } ,
resizer_{ other.resizer_ }
{
other.size_ = other.position_ = 0;
other.resizer_ = nullptr;
other.buffer_ = nullptr;
}
size_t T_MemoryOutputStream::write( void const* data , size_t size )
{
if ( position_ == size_ && !resizer_ ) {