hashed_string: linter directives for accepted C-like arrays

This commit is contained in:
Michele Caini
2024-05-31 08:20:55 +02:00
parent 659bcbc98c
commit 274d9ea89d

View File

@@ -119,6 +119,7 @@ public:
* @return The numeric representation of the string.
*/
template<std::size_t N>
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
[[nodiscard]] static constexpr hash_type value(const value_type (&str)[N]) noexcept {
return basic_hashed_string{str};
}
@@ -150,8 +151,9 @@ public:
* @param str Human-readable identifier.
*/
template<std::size_t N>
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
constexpr basic_hashed_string(const value_type (&str)[N]) noexcept
: base_type{helper(str)} {}
: base_type{helper(static_cast<const value_type *>(str))} {}
/**
* @brief Explicit constructor on purpose to avoid constructing a hashed
@@ -219,6 +221,7 @@ basic_hashed_string(const Char *str, const std::size_t len) -> basic_hashed_stri
* @param str Human-readable identifier.
*/
template<typename Char, std::size_t N>
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
basic_hashed_string(const Char (&str)[N]) -> basic_hashed_string<Char>;
/**