Date: Mon, 18 Aug 2025 14:51:25 +0000
The "basic" in the C++ standard library does not imply anything. Making the string_view remain valid after moving the string is not a problem in implementation, it only requires not eagerly cleaning up the moved-from string. This makes them similar to vector and span. Therefore, small_string is unnecessary.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Ben Crowhurst via Std-Proposals <std-proposals_at_[hidden]>
Sent: Monday, August 18, 2025 18:33
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Ben Crowhurst <ben.crowhurst_at_[hidden]>
Subject: [std-proposals] Forbid optimisations on std::basic_string implementations.
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
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Ben Crowhurst via Std-Proposals <std-proposals_at_[hidden]>
Sent: Monday, August 18, 2025 18:33
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Ben Crowhurst <ben.crowhurst_at_[hidden]>
Subject: [std-proposals] Forbid optimisations on std::basic_string implementations.
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 14:51:30