Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
character_set::next_char

Obtains the size of the first character of a string.

Synopsis
std::size_t(* next_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.

Function signature

The function signature should be: std::size_t (*next_char)(boost::span<const unsigned char> r).


PrevUpHomeNext