BLI: Avoid computing size when referencing std::string

The std::string already knows its size; there's no need to find it from scratch.

Pull Request: https://projects.blender.org/blender/blender/pulls/117757
This commit is contained in:
Hans Goudey
2024-02-02 17:48:52 +01:00
committed by Hans Goudey
parent 25acfc7497
commit 038ad97a7c
+4 -1
View File
@@ -449,7 +449,10 @@ inline StringRefNull::StringRefNull(const char *str) : StringRefBase(str, int64_
* Reference a std::string. Remember that when the std::string is destructed, the StringRefNull
* will point to uninitialized memory.
*/
inline StringRefNull::StringRefNull(const std::string &str) : StringRefNull(str.c_str()) {}
inline StringRefNull::StringRefNull(const std::string &str)
: StringRefNull(str.c_str(), int64_t(str.size()))
{
}
/**
* Get the char at the given index.