diff options
author | Roland Reichwein <mail@reichwein.it> | 2021-12-29 12:01:33 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2021-12-29 12:01:33 +0100 |
commit | 93efbaeef12f017bf72b3952f3b2a67ca9fec5de (patch) | |
tree | 12ebfdf9d994480901c571255ce4971036ae7f6e /include | |
parent | 658598c4231b63a2bafd324de2b5030939dd7e36 (diff) |
Better variable naming; inline; documentation
Diffstat (limited to 'include')
-rw-r--r-- | include/unicode.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/unicode.h b/include/unicode.h index 301f0db..1e19066 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -69,11 +69,11 @@ namespace unicode::detail { template<typename value_type, typename... Tbytes> inline bool is_utf8_sequence(value_type byte0, Tbytes... bytes) noexcept { - constexpr auto n{sizeof...(Tbytes) + 1}; + constexpr auto sequence_length{sizeof...(Tbytes) + 1}; - static_assert(n <= 4, "UTF-8 sequences of 1 through 4 code units are supported"); + static_assert(sequence_length <= 4, "UTF-8 sequences of 1 through 4 code units are supported"); - return is_utf8_leading_byte<n>(byte0) && + return is_utf8_leading_byte<sequence_length>(byte0) && (... && is_utf8_followup_byte(bytes)); // left fold for linear evaluation from left to right } @@ -196,13 +196,13 @@ namespace unicode::detail { utf_iterator(const utf_iterator& other) = default; utf_iterator& operator=(const utf_iterator& other) = default; - size_t remaining_code_units() const noexcept + inline size_t remaining_code_units() const noexcept { return std::distance(iterator, end_iterator); } template<size_t index> - value_type get_code_unit() const noexcept + inline value_type get_code_unit() const noexcept { if constexpr (std::is_same_v<Container, typename std::list<value_type>>) { // std::list doesn't support it + n @@ -724,6 +724,7 @@ namespace unicode { }; // class ArchitectureOptimizer + // Optimize for the case of all ASCII (7-bit) data in a accu size row // From and To are Encodings template<typename From, typename To, std::enable_if_t<std::is_empty<From>::value, bool> = true> typename To::string_type convert_optimized(const typename From::string_type& s) |