From 56d9ce21ce14ae8c8172449a68da97c2c2302842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Tue, 5 Nov 2024 21:43:39 +0200 Subject: [PATCH] Use `std::array` in code_point_set and code_points_multiset classes --- include/upa/url_percent_encode.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/upa/url_percent_encode.h b/include/upa/url_percent_encode.h index bc1baee..314f4db 100644 --- a/include/upa/url_percent_encode.h +++ b/include/upa/url_percent_encode.h @@ -13,7 +13,7 @@ #include "str_arg.h" #include "url_utf.h" #include "util.h" -#include +#include #include // uint8_t #include #include @@ -44,8 +44,7 @@ class code_point_set { /// @brief copy code points from @a other set /// @param[in] other code point set to copy from constexpr void copy(const code_point_set& other) { - for (std::size_t i = 0; i < arr_size_; ++i) - arr_[i] = other.arr_[i]; + arr_ = other.arr_; } /// @brief exclude @a c code point from set @@ -101,8 +100,7 @@ class code_point_set { } // Data - static const std::size_t arr_size_ = 32; - uint8_t arr_[arr_size_] = {}; + std::array arr_{}; }; @@ -287,8 +285,8 @@ class code_points_multiset { } // Data - static const std::size_t arr_size_ = 256; - uint8_t arr_[arr_size_] = {}; + std::array arr_{}; + }; inline constexpr code_points_multiset code_points;