GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libstdc++ Performance Win

libstdc++ implements string modifier optimizations for C++.

C++ string append/assign methods now efficiently handle substrings from C-style strings.

The libstdc++ library has implemented new overloads for basic_string::append and basic_string::assign. These updates address LWG3662, enabling more efficient handling of operations that append or assign a portion of a null-terminated byte string (NTBS) at a specified position and length, improving performance for common string manipulations.

In Details

libstdc++ string modifiers, specifically basic_string::append and basic_string::assign. Implements LWG3662 to add overloads accepting a const char* (NTBS), a starting position, and a count. This addresses suboptimal performance when manipulating portions of C-style strings previously requiring intermediate conversions.

For Context
libstdc++
The standard C++ library implementation used by GCC, providing fundamental classes and functions for C++ development.
basic_string
The standard C++ class for manipulating sequences of characters, providing dynamic resizing and various string operations.
NTBS
Null-Terminated Byte String. A sequence of bytes in memory terminated by a null character ('\0'), commonly used for C-style strings.
LWG3662
A specific issue number from the C++ Library Working Group, addressing a performance deficiency in the basic_string::append and assign methods.
Filed Under: libstdc++stringc++