Replace wstring_convert with std::wstring (#9614)

* remove wstring_convert

* .

* fix indentation
This commit is contained in:
Jingqiao Fu 2021-10-29 19:03:54 -07:00 committed by GitHub
parent f7774a91d6
commit a3e4d77b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,9 +46,11 @@ ThreadPoolProfiler::ThreadPoolProfiler(int num_threads, const CHAR_TYPE* thread_
child_thread_stats_.assign(num_threads, {});
if (thread_pool_name) {
#ifdef _WIN32
using convert_type = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_type, wchar_t> converter;
thread_pool_name_ = converter.to_bytes(thread_pool_name);
std::wstring ws(thread_pool_name);
thread_pool_name_.resize(ws.length());
std::transform(ws.begin(), ws.end(), thread_pool_name_.begin(), [] (wchar_t c) {
return (char)c;
});
#else
thread_pool_name_ = thread_pool_name;
#endif