Buffers - append() method
This commit is contained in:
parent
6f52668540
commit
d2122aff38
2 changed files with 15 additions and 0 deletions
|
@ -98,6 +98,7 @@ class T_Buffer : public T_BufferBase
|
|||
MyType_& resize( size_t newSize );
|
||||
MyType_& setAll( T const& value );
|
||||
MyType_& copyAll( T const* data );
|
||||
MyType_& append( T const* data , size_t size );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -260,6 +260,20 @@ inline T_Buffer< T >& T_Buffer< T >::copyAll( T const* data )
|
|||
return *this;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T_Buffer< T >& T_Buffer< T >::append(
|
||||
T const* data ,
|
||||
size_t size )
|
||||
{
|
||||
if ( size != 0 ) {
|
||||
const auto os{ size_ };
|
||||
resize( os + size );
|
||||
memcpy( data_ + os * sizeof( T ) ,
|
||||
data , size * sizeof( T ) );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
#endif // _H_EBCL_INLINE_BUFFERS
|
||||
|
|
Loading…
Reference in a new issue