1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_WIN_WIN_UTIL_H_ 6 #define BASE_WIN_WIN_UTIL_H_ 7 8 #include <string> 9 #include <string_view> 10 11 namespace base { 12 13 // Windows API calls take wchar_t but on that platform wchar_t should be the 14 // same as a char16_t. ToWCharT(const std::u16string * s)15inline const wchar_t* ToWCharT(const std::u16string* s) { 16 static_assert(sizeof(std::u16string::value_type) == sizeof(wchar_t)); 17 return reinterpret_cast<const wchar_t*>(s->c_str()); 18 } 19 ToWCharT(const char16_t * s)20inline const wchar_t* ToWCharT(const char16_t* s) { 21 return reinterpret_cast<const wchar_t*>(s); 22 } 23 ToWCharT(char16_t * s)24inline wchar_t* ToWCharT(char16_t* s) { 25 return reinterpret_cast<wchar_t*>(s); 26 } 27 28 } // namespace base 29 30 #endif // BASE_WIN_WIN_UTIL_H_ 31