Skip to content

Commit 3333f95

Browse files
author
MarcoFalke
committed
refactor: Avoid casting away constness
Seems confusing and brittle to remove const and then add it back in the return type.
1 parent fa6394d commit 3333f95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/span.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ Span<std::byte> MakeWritableByteSpan(V&& v) noexcept
270270
inline unsigned char* UCharCast(char* c) { return (unsigned char*)c; }
271271
inline unsigned char* UCharCast(unsigned char* c) { return c; }
272272
inline unsigned char* UCharCast(std::byte* c) { return (unsigned char*)c; }
273-
inline const unsigned char* UCharCast(const char* c) { return (unsigned char*)c; }
273+
inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast<const unsigned char*>(c); }
274274
inline const unsigned char* UCharCast(const unsigned char* c) { return c; }
275275
inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); }
276276

0 commit comments

Comments
 (0)