summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-28 20:48:24 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-28 20:48:24 +0100
commit658598c4231b63a2bafd324de2b5030939dd7e36 (patch)
tree5b462131526731443b9a590f5ade920fd326c979 /include
parenta5dc41291537d9518fbbd795d118a3b4bcb9764e (diff)
Minor simplifications
Diffstat (limited to 'include')
-rw-r--r--include/unicode.h10
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>