Tser can now output wstring and already saves wstring, so now need to use it.
This commit is contained in:
parent
b113b90257
commit
babc190525
2 changed files with 8 additions and 2 deletions
4
tser.hpp
4
tser.hpp
|
@ -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[";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue