| Home | Libraries | People | FAQ | More

##### character_set::next_char

Obtains the size of the first character of a string.

###### Synopsis

    std::size_t(*next_char)(span< const unsigned char >);

###### Description

Given a range of bytes, `r`, this function must interpret `r` as a string encoded using this character set, and return the number of bytes that the first character in the string spans, or 0 in case of error. `r` is guaranteed to be non-empty (`r.size() > 0`).

In some character sets (like UTF-8), not all byte sequences represent valid characters. If this function finds an invalid byte sequence while trying to interpret the first character, it should return 0 to signal the error.

This function must not throw exceptions or have side effects.