From 3333f950d49f13662842650ae76599a0dff052eb Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Sat, 22 Jul 2023 16:26:28 +0200 Subject: [PATCH] refactor: Avoid casting away constness Seems confusing and brittle to remove const and then add it back in the return type. --- src/span.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/span.h b/src/span.h index 0563556dc27..792a0a9c075 100644 --- a/src/span.h +++ b/src/span.h @@ -270,7 +270,7 @@ Span MakeWritableByteSpan(V&& v) noexcept inline unsigned char* UCharCast(char* c) { return (unsigned char*)c; } inline unsigned char* UCharCast(unsigned char* c) { return c; } inline unsigned char* UCharCast(std::byte* c) { return (unsigned char*)c; } -inline const unsigned char* UCharCast(const char* c) { return (unsigned char*)c; } +inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast(c); } inline const unsigned char* UCharCast(const unsigned char* c) { return c; } inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast(c); }