Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Build Your Own std::string in C++

CppNuts via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn to build a custom string class in C++ by implementing your own version of std::string from scratch. Master dynamic memory management, the Rule of 3/5, and essential string operations through hands-on coding. Explore class structure design, default and parameterized constructors, deep copy mechanisms, and destructor implementation. Implement the copy-and-swap idiom for safe copy assignment, along with move constructor and move assignment for efficient resource management. Add core functionality including length() method, c_str() access, substr() for string extraction, operator[] for indexing, and equality/inequality comparison operators. Follow modern C++ practices while understanding the internal workings of string classes, memory allocation strategies, and performance optimization techniques that make std::string so effective in real-world applications.

Syllabus

00:00 – Introduction
01:38 – Class structure
02:00 – Default Constructor
02:16 – Parameter Constructor
04:15 – Move Constructor
04:40 – Move Assignment

Taught by

CppNuts

Reviews

Start your review of Build Your Own std::string in C++

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.