|
SofaBuffers C/C++ 0.12.0
API Documentation
|
Functions | |
| std::size_t | utf8Prefix (std::string_view sv, std::size_t n) noexcept |
Length of the longest prefix of sv that is at most n bytes and does not end inside a UTF-8 character; sv is longer than n. | |
|
inlinenoexcept |
Length of the longest prefix of sv that is at most n bytes and does not end inside a UTF-8 character; sv is longer than n.
The over-long half of FixedString's assignment-time clamp, one copy for every capacity: the cut moves back while the first byte left out is a continuation byte (10xxxxxx), so a valid UTF-8 sv keeps a valid UTF-8 prefix. The common case – the value fits – stays inline in FixedString::assign, where a literal's length folds away.
Definition at line 269 of file sofab.hpp.