Is there a way to disallow new allocations by a std::string instance?
No, but instead we can use std::pmr::string since c++17 (If the string is guaranteed to be small enough: say shorter than 16bytes, we may benefit from the std::string's short string optimization in recent version STLS then memory allocation would not happen, but it's a black-box)
constexpr size_t kMaxLen = 256; char buffer[kMaxLen] = {}; std::pmr::monotonic_buffer_resource pool{std::data(buffer),std::size(buffer)}; std::pmr::string vec{&pool}; // assert that we don't have a string with a length larger than kMaxLen - 1, or we will trigger heap memory allocations
Is there a standard fixed-length string class?
NO, but we may choose non standard libraries as the alternatives:
std::array?"\0") will not allocate, which is very useful in itself. Any other claim or dependency on the short string optimization is really just a nice to have detail but it is not fundamental.