mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 11:55:37 +00:00
Common/String: Support casting to std::string_View
This commit is contained in:
parent
36444b264f
commit
39498849bd
|
@ -4,6 +4,7 @@
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
//
|
//
|
||||||
// String
|
// String
|
||||||
|
@ -221,6 +222,10 @@ public:
|
||||||
// m_pStringData->pBuffer[i]; }
|
// m_pStringData->pBuffer[i]; }
|
||||||
operator const char*() const { return GetCharArray(); }
|
operator const char*() const { return GetCharArray(); }
|
||||||
operator char*() { return GetWriteableCharArray(); }
|
operator char*() { return GetWriteableCharArray(); }
|
||||||
|
operator std::string_view() const
|
||||||
|
{
|
||||||
|
return IsEmpty() ? std::string_view() : std::string_view(GetCharArray(), GetLength());
|
||||||
|
}
|
||||||
|
|
||||||
// Will use the string data provided.
|
// Will use the string data provided.
|
||||||
String& operator=(const String& copyString)
|
String& operator=(const String& copyString)
|
||||||
|
|
Loading…
Reference in a new issue