Tser can now output wstring and already saves wstring, so now need to use it.

This commit is contained in:
Zed A. Shaw 2024-11-04 23:58:56 -05:00
parent b113b90257
commit babc190525
2 changed files with 8 additions and 2 deletions

View file

@ -8,6 +8,7 @@
#include <string_view>
#include <type_traits>
#include <tuple>
#include <codecvt>
namespace tser{
//implementation details for C++20 is_detected
@ -89,6 +90,9 @@ namespace tser{
using V = std::decay_t<T>;
if constexpr (std::is_constructible_v<std::string, T> || std::is_same_v<V, char>) {
os << "\"" << val << "\"";
} else if constexpr (std::is_constructible_v<std::wstring, T> || std::is_same_v<V, char>) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
os << "\"" << converter.to_bytes(val) << "\"";
} else if constexpr (is_container_v<V>) {
size_t i = 0;
os << "\n[";