compare(const CharT* s) constructed a temporary basic_static_cstring<N>
from s and delegated to the class-type overload. The constructor throws
std::length_error when traits::length(s) > N, and because compare() is
noexcept, the throw led to std::terminate():
static_cstring<3> s("abc");
s.compare("abcd"); // terminate() via noexcept throw
The free operator==() / operator!=() overloads for const CharT*, which
delegate to compare(), had the same flaw.
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
This introduces an alternative to basic_static_string designed for use
in POD types: Trivially copyable, having a sizeof == N + 1, with no
embedded NULs.
Placed in example/ to gather user feedback before committing to a public
API. See issue #23.