stringboostlocalizationinternationalizationboost-locale

What Boot.Locale means by "linear/contiguous chunks of text"?


I reading Boost.Locale: Design Rationale and there is chapter Why most parts of Boost.Locale work only on linear/contiguous chunks of text, what linear/contiguous chunks of text means in this context?


Solution

  • It means the text to be processed has to be placed in a contiguous region of memory, with no gaps. It must not be split in the middle of a multibyte character or on a boundary between combined characters (e.g. a letter and an accent). You can split it on other character boundaries, but you will have to process each portion of the text yourself, as from Boost.Locale perspective each portion will be independent from the other.

    In practical terms, you can use std::string or std::vector to store the text, but not std::deque or std::list.