C++20 Port #5
| @ -21,10 +21,12 @@ export namespace core { | ||||
| 			this->buffer[max] = max; | ||||
| 		} | ||||
| 
 | ||||
| 		template<usize text_size> constexpr path(char const(&text)[text_size]) { | ||||
| 		template<usize text_size> constexpr path(char const(&text)[text_size]) : path{} { | ||||
| 			static_assert(text_size <= max, "path cannot be longer than maximum length"); | ||||
| 			copy(this->buffer, text.as_bytes()); | ||||
| 			zero(slice{this->buffer}.sliced(text_size, max - text_size)); | ||||
| 
 | ||||
| 			for (usize i = 0; i < text_size; i += 1) this->buffer[i] = text[i]; | ||||
| 
 | ||||
| 			this->buffer[max] = max - text_size; | ||||
| 		} | ||||
| 
 | ||||
| 		/**
 | ||||
| @ -56,7 +58,7 @@ export namespace core { | ||||
| 		 * Returns the tail pointer of the path name. | ||||
| 		 */ | ||||
| 		char const * end() const { | ||||
| 			return reinterpret_cast<char const *>(this->buffer) + this->byte_size(); | ||||
| 			return this->buffer + this->byte_size(); | ||||
| 		} | ||||
| 
 | ||||
| 		/**
 | ||||
| @ -96,7 +98,7 @@ export namespace core { | ||||
| 		} | ||||
| 
 | ||||
| 		private: | ||||
| 		u8 buffer[max + 1]; | ||||
| 		char buffer[max + 1]; | ||||
| 	}; | ||||
| 
 | ||||
| 	/**
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user