summaryrefslogtreecommitdiff
path: root/include/fud_string.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-03-31 08:33:08 -0500
committerDominick Allen <djallen@librehumanitas.org>2025-03-31 08:33:08 -0500
commit8b0bc70db73b48d833a3b5791e55921768cf6932 (patch)
tree862ae34933a7fc9f480038d974f59d7683a82605 /include/fud_string.hpp
parentc426110f24516f92ecb8a5374e2a281f2c79787a (diff)
Remove reinterpret_cast usage in favor of std::bit_cast.
Diffstat (limited to 'include/fud_string.hpp')
-rw-r--r--include/fud_string.hpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp
index 1c189c2..2c2173b 100644
--- a/include/fud_string.hpp
+++ b/include/fud_string.hpp
@@ -133,8 +133,7 @@ class String {
if constexpr (std::is_same_v<decltype(cStringItem), const char*>) {
cString = cStringItem;
} else if constexpr (std::is_same_v<decltype(cStringItem), const utf8*>) {
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- cString = reinterpret_cast<const char*>(cStringItem);
+ cString = std::bit_cast<const char*>(cStringItem);
} else {
static_assert(!std::is_same_v<decltype(cStringItem), const char*>);
}
@@ -275,8 +274,7 @@ class String {
/** \brief The underlying data as an explicit c string. */
[[nodiscard]] const char* c_str() const
{
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- return reinterpret_cast<const char*>(data());
+ return std::bit_cast<const char*>(data());
}
[[nodiscard]] StringView asView() const