Files
static_string/example/static_cstring
Gennaro Prota c6cd8074ab Fix the comparison operators for basic_static_cstring
The defaulted operators had the wrong semantics, as they compared the
entire data_ buffer. The bug showed up when shrinking:

  static_cstring<10> s("hello");
  s.assign("hi", 2);              // data_[3..4] still "lo"
  static_cstring<10> fresh("hi");
  assert(s == fresh);             // FAILED
2026-04-21 11:59:41 +02:00
..

This directory contains an experimental implementation of basic_static_cstring, which differs from basic_static_string in the following ways:

basic_static_cstring basic_static_string
Layout sizeof == N + 1 Has size member
Embedded NULs Not supported Supported
Trivially copyable Yes No

Additionally, when N <= UCHAR_MAX, basic_static_cstring employs an optimization that avoids calling std::strlen() to compute the size.

This work stems from boostorg/static_string#23.

If you believe basic_static_cstring should become part of the public API, please share your feedback on the Boost mailing list.