From 93efbaeef12f017bf72b3952f3b2a67ca9fec5de Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Wed, 29 Dec 2021 12:01:33 +0100 Subject: Better variable naming; inline; documentation --- include/unicode.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include') 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 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(byte0) && + return is_utf8_leading_byte(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 - value_type get_code_unit() const noexcept + inline value_type get_code_unit() const noexcept { if constexpr (std::is_same_v>) { // 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::value, bool> = true> typename To::string_type convert_optimized(const typename From::string_type& s) -- cgit v1.2.3