We're using a
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
in a logger of ours that gets a UTF-16 string from a legacy component and converts it to UTF-8 that we write to the log. The converter gets instantiated on each conversion, upon which we do
auto utf8string = converter.to_bytes(utf16string);
This is done in a pretty intensive and multi-threaded part of our code and I'd like to re-use one instance of the converter, but seing that std::wstring_convert exposes a "state", I'm worried that to_bytes is not thread safe and any gains we could get by reusing the same instance would be lost by the excessive locking that would then be needed (in which case I wouldn't share the instance anyway).
So, is std::wstring_convert<>::to_bytes thread safe?
EDIT: A clarification on what I'm really asking: Given one instance of std::wstring_convert<>, if 2 or more threads concurrently call to_bytes on that instance with different arguments, is to_bytes then guaranteed to behave well?