bn::utf8_characters_map_ref class

Maps a list of UTF-8 characters to their position in the list.

Public types

struct item_type
Map item info.

Constructors, destructors, conversion operators

utf8_characters_map_ref() defaulted constexpr
Default class constructor.
utf8_characters_map_ref(const item_type& items_ref, int items_count, int characters_count) constexpr
Class constructor.

Public functions

auto size() const -> int constexpr
Returns the mapped UTF-8 characters count.
auto empty() const -> bool constexpr
Indicates if it doesn't contain any mapped UTF-8 character.
auto index(const utf8_character& character) const -> int constexpr
Searches for the position of a given UTF-8 character in the input list.

Function documentation

bn::utf8_characters_map_ref::utf8_characters_map_ref(const item_type& items_ref, int items_count, int characters_count) constexpr

Class constructor.

Parameters
items_ref Reference to a list of map items.
items_count Referenced map items count.
characters_count Mapped UTF-8 characters count.

Map items are not copied but referenced, so they should outlive the utf8_characters_map_ref to avoid dangling references.

int bn::utf8_characters_map_ref::index(const utf8_character& character) const constexpr

Searches for the position of a given UTF-8 character in the input list.

Parameters
character UTF-8 character to search for.
Returns Position of the UTF-8 character in the input list.