Arrays - Bug fix on resize( )

Default constructor was not being called for new items.
This commit is contained in:
Emmanuel BENOîT 2017-11-14 20:58:01 +01:00
parent 9f666eea49
commit 1ce16d63cb

View file

@ -204,7 +204,7 @@ inline T_Array< T >& T_Array< T >::resize(
{
if ( size > size_ ) {
ensureCapacity( size );
for ( auto i = size_ ; i < size_ ; i ++ ) {
for ( auto i = size_ ; i < size ; i ++ ) {
::new ( reinterpret_cast< char* >( &data_[ i ] ) ) T( );
}
}
@ -220,7 +220,7 @@ inline T_Array< T >& T_Array< T >::resize(
{
if ( size > size_ ) {
ensureCapacity( size );
for ( auto i = size_ ; i < size_ ; i ++ ) {
for ( auto i = size_ ; i < size ; i ++ ) {
::new ( reinterpret_cast< char* >( &data_[ i ] ) ) T( value );
}
}