8293595: tstrings::any() is missing an overload

Reviewed-by: asemenyuk, almatvee
This commit is contained in:
Julian Waters 2022-09-20 13:04:35 +00:00 committed by Alexey Semenyuk
parent 0f28cb06ab
commit bb422f5c14

View File

@ -356,6 +356,11 @@ namespace tstrings {
data << fromUtf8(msg); data << fromUtf8(msg);
} }
any& operator << (const std::string& msg) {
data << fromUtf8(msg);
return *this;
}
#ifdef TSTRINGS_WITH_WCHAR #ifdef TSTRINGS_WITH_WCHAR
any(std::wstring::const_pointer msg) { any(std::wstring::const_pointer msg) {
data << msg; data << msg;
@ -365,22 +370,22 @@ namespace tstrings {
data << msg; data << msg;
} }
any& operator << (const std::wstring& v) { any& operator << (const std::wstring& msg) {
data << v; data << msg;
return *this; return *this;
} }
// need this specialization instead std::wstring::pointer, // need this specialization instead std::wstring::pointer,
// otherwise LPWSTR is handled as abstract pointer (void*) // otherwise LPWSTR is handled as abstract pointer (void*)
any& operator << (LPWSTR v) { any& operator << (LPWSTR msg) {
data << (v ? v : L"NULL"); data << (msg ? msg : L"NULL");
return *this; return *this;
} }
// need this specialization instead std::wstring::const_pointer, // need this specialization instead std::wstring::const_pointer,
// otherwise LPCWSTR is handled as abstract pointer (const void*) // otherwise LPCWSTR is handled as abstract pointer (const void*)
any& operator << (LPCWSTR v) { any& operator << (LPCWSTR msg) {
data << (v ? v : L"NULL"); data << (msg ? msg : L"NULL");
return *this; return *this;
} }