Ignore:
Timestamp:
07/23/15 17:29:49 (10 years ago)
Author:
epyon
Message:
  • massive amount of std::string removal
  • removed slurp, use filesystem::slurp instead
  • lua_values const_string support
  • several bugfixes
  • program_manager and shader loading without std::string/std::stream
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/stl/container/growing_storage.hh

    r437 r438  
    112112                inline growing_storage& operator=( growing_storage&& other )
    113113                {
    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                        }
    118120                        return *this;
    119121                }
     
    179181                void insert( iterator position, const value_type& value )
    180182                {
    181                         iterator iend = Storage::data() + m_size;
     183                        ptrdiff_t offset = position - Storage::data();
    182184                        if ( try_grow( 1 ) )
    183185                        {
    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 );
    186190                        }
    187191                }
     
    192196                        // TODO: distance can't be called on destructive iterators - check
    193197                        //   and use pushback if needed?
    194                         iterator iend = Storage::data() + m_size;
     198                        ptrdiff_t offset = position - Storage::data();
    195199                        size_type d = distance( first, last );
    196200                        if ( try_grow( d ) )
    197201                        {
    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 );
    200206                        }
    201207                }
Note: See TracChangeset for help on using the changeset viewer.