C++ Logo

std-proposals

Advanced search

[std-proposals] Forbid optimisations on std::basic_string implementations.

From: Ben Crowhurst <ben.crowhurst_at_[hidden]>
Date: Mon, 18 Aug 2025 10:33:20 +0000
There is a history of STL implementations introducing string optimisations, for example, copy-on-write in GCC (<=4), adoption of small string optimisation (SSO) - with varying details across GCC, Clang, and MSVC.

Focusing on SSO, using std::string, along with std::string_view and move semantics, introduces a frustrating folly.

The name std::basic_string implies a basic implementation, and many assume it is nothing more than a wrapper around a C-style character pointer with bounds checking.

Could we discuss introducing an alternative string implementation (std::buffered_string, std::small_string) to the standard that allows optimisations without specifying the core details? Hopefully, this will add some clarity to the end-user.

Thank you for your time.

Regards,
Ben Crowhurst

Received on 2025-08-18 10:33:30