From 730d0dfc0cd49b837008024f68a4fbb4058fe77e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 28 Mar 2025 17:21:56 -0400 Subject: [PATCH] Cleanup: Fix constexpr for StringRefNull c-string constructor Similar to c4d514507060c8a6357df4fc32f222fc1fe0b1a8. --- source/blender/blenlib/BLI_string_ref.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index f50465ad6bb..53ccfd5ae81 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -124,7 +124,7 @@ class StringRefNull : public StringRefBase { constexpr StringRefNull(); constexpr StringRefNull(const char *str, int64_t size); StringRefNull(std::nullptr_t) = delete; - StringRefNull(const char *str); + constexpr StringRefNull(const char *str); StringRefNull(const std::string &str); constexpr char operator[](int64_t index) const; @@ -431,7 +431,8 @@ constexpr StringRefNull::StringRefNull(const char *str, const int64_t size) * Construct a StringRefNull from a null terminated c-string. The pointer must not point to * NULL. */ -inline StringRefNull::StringRefNull(const char *str) : StringRefBase(str, int64_t(strlen(str))) +constexpr StringRefNull::StringRefNull(const char *str) + : StringRefBase(str, int64_t(std::char_traits::length(str))) { BLI_assert(str != nullptr); BLI_assert(data_[size_] == '\0');