tahonermann / text_view

A C++ concepts and range based character encoding and code point enumeration library
MIT License
122 stars 14 forks source link

Remove min_code_units and max_code_units data members from encodings #3

Open tahonermann opened 8 years ago

tahonermann commented 8 years ago

The min_code_units and max_code_units data members of encoding types were originally added to facilitate code unit storage allocation given a sequence of code points. For encodings like UTF16 with a BOM, these data members don't suffice due to the storage overhead required for a BOM. Additionally, encodings that support non-code-point encoding state transitions, overhead is potentially unbounded and not reflected in these values.

At present, these values are only used to determine if an encoding can potentially support random access to code points (when min_code_units == max_code_units and the encoding is stateless). Removal of these data members will require some other means to determine if an encoding is a stateless fixed-length encoding.