Changeset 438 for trunk/nv/stl/string/short_string.hh
- Timestamp:
- 07/23/15 17:29:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/stl/string/short_string.hh
r435 r438 10 10 #include <nv/stl/string/common.hh> 11 11 #include <nv/stl/string/string_base.hh> 12 #include <nv/stl/string/string_twine.hh> 12 13 #include <nv/stl/container/random_access.hh> 13 14 #include <nv/stl/container/contiguous_storage.hh> … … 32 33 } 33 34 35 36 template < typename Base > 37 inline explicit string_buffer_base( const string_base< Base >& s ) : this_type( s.data(), s.size() ) {} 34 38 inline explicit string_buffer_base( const string_view& s ) : this_type( s.data(), s.size() ) {} 35 template < typename S > 36 inline string_buffer_base( const string_base<S>& rhs ) : this_type( rhs.data(), rhs.size() ) {} 39 40 inline string_buffer_base( const string_twine& twine ) 41 { 42 append( twine ); 43 } 37 44 inline string_buffer_base( string_buffer_base&& copy ) = default; 38 45 inline string_buffer_base& operator=( string_buffer_base&& other ) = default; 39 inline string_buffer_base& operator=( const string_view& other )40 {41 clear();42 append( other );43 }44 46 45 47 size_t append( const char* data, size_t sz ) … … 49 51 raw_copy_n( data, amount, this->begin() + pos ); 50 52 return amount; 53 } 54 55 size_t append( const string_twine& twine ) 56 { 57 size_t pos = size(); 58 size_t dump_size = twine.dump_size(); 59 expand_by( dump_size ); 60 twine.dump( array_ref< char >( data() + pos, size() - pos ) ); 61 return size() - pos; 51 62 } 52 63 … … 111 122 void reserve( size_type new_capacity ) 112 123 { 113 Storage::reserve( new_capacity + 1 , true);124 Storage::reserve( new_capacity + 1 ); 114 125 this->data()[this->size()] = 0; 115 126 } … … 117 128 void resize( size_type new_size ) 118 129 { 119 Storage::reserve( new_size + 1 , true);130 Storage::reserve( new_size + 1 ); 120 131 Storage::resize( min( new_size, capacity() - 1 ) ); 121 132 this->data()[this->size()] = 0;
Note: See TracChangeset
for help on using the changeset viewer.