From a3e4d77b357ed36d9414029afc7f8cc1f863726f Mon Sep 17 00:00:00 2001 From: Jingqiao Fu Date: Fri, 29 Oct 2021 19:03:54 -0700 Subject: [PATCH] Replace wstring_convert with std::wstring (#9614) * remove wstring_convert * . * fix indentation --- onnxruntime/core/common/threadpool.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/onnxruntime/core/common/threadpool.cc b/onnxruntime/core/common/threadpool.cc index 64cc921bc0..6354a4b80b 100644 --- a/onnxruntime/core/common/threadpool.cc +++ b/onnxruntime/core/common/threadpool.cc @@ -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; - std::wstring_convert 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