@ -298,9 +298,8 @@ public:
}
}
void resize ( size_type new_size ) {
void resize ( size_type new_size ) {
while ( size ( ) > new_size ) {
if ( size ( ) > new_size ) {
item_ptr ( size ( ) - 1 ) - > ~ T ( ) ;
erase ( item_ptr ( new_size ) , end ( ) ) ;
_size - - ;
}
}
if ( new_size > capacity ( ) ) {
if ( new_size > capacity ( ) ) {
change_capacity ( new_size ) ;
change_capacity ( new_size ) ;
@ -368,10 +367,7 @@ public:
}
}
iterator erase ( iterator pos ) {
iterator erase ( iterator pos ) {
( * pos ) . ~ T ( ) ;
return erase ( pos , pos + 1 ) ;
memmove ( & ( * pos ) , & ( * pos ) + 1 , ( ( char * ) & ( * end ( ) ) ) - ( ( char * ) ( 1 + & ( * pos ) ) ) ) ;
_size - - ;
return pos ;
}
}
iterator erase ( iterator first , iterator last ) {
iterator erase ( iterator first , iterator last ) {
@ -396,7 +392,7 @@ public:
}
}
void pop_back ( ) {
void pop_back ( ) {
_size - - ;
erase ( end ( ) - 1 , end ( ) ) ;
}
}
T & front ( ) {
T & front ( ) {
@ -416,12 +412,7 @@ public:
}
}
void swap ( prevector < N , T , Size , Diff > & other ) {
void swap ( prevector < N , T , Size , Diff > & other ) {
if ( _size & other . _size & 1 ) {
std : : swap ( _union , other . _union ) ;
std : : swap ( _union . capacity , other . _union . capacity ) ;
std : : swap ( _union . indirect , other . _union . indirect ) ;
} else {
std : : swap ( _union , other . _union ) ;
}
std : : swap ( _size , other . _size ) ;
std : : swap ( _size , other . _size ) ;
}
}