String Class/Data Structure Implementation in C++ (How the C++ 'string' Datatype/Class Works)

preview_player
Показать описание
The C++ string class is a very valuable addition to the C++ library. Every wonder how they did it? Here is an example string class. It takes c-strings, String objects, or numbers which are converted to String objects. It copies, assigns and concatenates strings, String objects and numbers using operator overloading. It is very fast taking advantage of the 32-bit or 64-bit registers of a computer and not copying data one byte at a time (when copying from another String object). This String object only consumes 4 bytes of stack space on 32-bit systems and 8 bytes on 64-bit systems.

Be familiar with arrays, which a string is, pointers and operator overloading in C++.

Coding begins @ 2:11
Coding the String class specifically: 4:35
Function to convert number to string: 4:44
Copy constructors: 6:08
Overloaded operators: 7:37

To code along, slow the video down and disable the sound.
Рекомендации по теме