diff options
Diffstat (limited to 'include/unicode.h')
-rw-r--r-- | include/unicode.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/unicode.h b/include/unicode.h index 8ac9f55..301f0db 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -204,7 +204,7 @@ namespace unicode::detail { template<size_t index> value_type get_code_unit() const noexcept { - if constexpr (std::is_same<Container, typename std::list<value_type>>::value) { + if constexpr (std::is_same_v<Container, typename std::list<value_type>>) { // std::list doesn't support it + n auto it{iterator}; std::advance(it, index); @@ -374,7 +374,7 @@ namespace unicode::detail { template<typename... Args> inline void append(Args&&... args) { - if constexpr (std::is_same<Container, typename std::basic_string<value_type>>::value) { + if constexpr (std::is_same_v<Container, typename std::basic_string<value_type>>) { s.append({args...}); } else { (s.emplace_back(args), ...); @@ -390,10 +390,10 @@ namespace unicode::detail { append(byte_n_of_m<0,2>(value), byte_n_of_m<1,2>(value)); } else if (value < 0x10000) { // 3 bytes append(byte_n_of_m<0,3>(value), byte_n_of_m<1,3>(value), byte_n_of_m<2,3>(value)); - } else if (value < 0x110000) { // 4 bytes + } else { // 4 bytes + // expect value to be already valid Unicode values (checked in input iterator) append(byte_n_of_m<0,4>(value), byte_n_of_m<1,4>(value), byte_n_of_m<2,4>(value), byte_n_of_m<3,4>(value)); - } else - throw std::runtime_error("Invalid internal Unicode value: "s + std::to_string(static_cast<uint32_t>(value))); + } } template<class X = value_type, typename std::enable_if_t<(sizeof(X) == 2), bool> = true> |