Changeset 438 for trunk/nv/stl/container/growing_storage.hh
- Timestamp:
- 07/23/15 17:29:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/stl/container/growing_storage.hh
r437 r438 112 112 inline growing_storage& operator=( growing_storage&& other ) 113 113 { 114 Storage::reallocate( 0, false ); 115 m_size = other.m_size; 116 Storage::operator=( nv::move( other ) ); 117 other.m_size = size_impl_type(); 114 if ( this != &other ) 115 { 116 m_size = other.m_size; 117 Storage::operator=( nv::move( other ) ); 118 other.m_size = size_impl_type(); 119 } 118 120 return *this; 119 121 } … … 179 181 void insert( iterator position, const value_type& value ) 180 182 { 181 iterator iend = Storage::data() + m_size;183 ptrdiff_t offset = position - Storage::data(); 182 184 if ( try_grow( 1 ) ) 183 185 { 184 raw_alias_copy( position, iend, position + 1 ); 185 copy_construct_object( position, value ); 186 iterator iposition = Storage::data() + offset; 187 iterator iend = Storage::data() + m_size - 1; 188 raw_alias_copy( iposition, iend, iposition + 1 ); 189 copy_construct_object( iposition, value ); 186 190 } 187 191 } … … 192 196 // TODO: distance can't be called on destructive iterators - check 193 197 // and use pushback if needed? 194 iterator iend = Storage::data() + m_size;198 ptrdiff_t offset = position - Storage::data(); 195 199 size_type d = distance( first, last ); 196 200 if ( try_grow( d ) ) 197 201 { 198 raw_alias_copy( position, iend, position + d ); 199 InitializePolicy::copy( first, last, position ); 202 iterator iposition = Storage::data() + offset; 203 iterator iend = Storage::data() + m_size - d; 204 raw_alias_copy( iposition, iend, iposition + d ); 205 InitializePolicy::copy( first, last, iposition ); 200 206 } 201 207 }
Note: See TracChangeset
for help on using the changeset viewer.