Skip to content

Commit

Permalink
Use std::array in code_point_set and code_points_multiset classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Nov 5, 2024
1 parent e12cb4e commit 4c96f09
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions include/upa/url_percent_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "str_arg.h"
#include "url_utf.h"
#include "util.h"
#include <cstddef>
#include <array>
#include <cstdint> // uint8_t
#include <initializer_list>
#include <string>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -101,8 +100,7 @@ class code_point_set {
}

// Data
static const std::size_t arr_size_ = 32;
uint8_t arr_[arr_size_] = {};
std::array<uint8_t, 32> arr_{};
};


Expand Down Expand Up @@ -287,8 +285,7 @@ class code_points_multiset {
}

// Data
static const std::size_t arr_size_ = 256;
uint8_t arr_[arr_size_] = {};
std::array<uint8_t, 256> arr_{};
};

inline constexpr code_points_multiset code_points;
Expand Down

0 comments on commit 4c96f09

Please sign in to comment.