Inside STL: The string -- Raymond Chen
You might think that a std::string (and all of its friends in the std::basic_string family) are basically a vector of characters internally. But strings are organized differently due to specific optimizations permitted for strings but not for vectors.
Inside STL: The string
By Raymond Chen
From the article:
The starting point for a
std::is this:¹basic_string template<typename T> struct basic_string { T* ptr; size_t size; size_t capacity; };The
ptris a pointer to the beginning of the string contents.The
sizeis the number of characters in the string, not including the null terminator.The
capacityis the string capacity, not including the null terminator.The picture for this simplified version is as follows:



In this article, we’d shed some light on the implementation of
In this article, we are going to review two new features of C++23. Now the language allows the call operator (
The Curiously Recurring Template Pattern (CRTP) is a heavily used idiom in C++. It is similarly resistant to understanding as the classic design pattern visitor I presented in my last post: “