1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

fix #122 add static_assert to limit size of N in static_string (#123)

This commit is contained in:
rpatters1 2022-01-25 12:14:23 -06:00 committed by GitHub
parent 1f9e8c2993
commit a8c9e57fbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,6 +165,7 @@ struct char_equal_to {
template <std::size_t N>
class static_string {
static_assert(N < UINT16_MAX, "Length of static_string must be less than UINT16_MAX.");
public:
constexpr explicit static_string(string_view str) noexcept : static_string{str, std::make_index_sequence<N>{}} {
assert(str.size() == N);