From 5fdb88a8acb858bb9aa2885ec161d2a452b0d0f5 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 23 Dec 2019 03:09:21 +0300 Subject: [PATCH] Return JsonScope::operator<< overloads for string literals and pointers, because otherwise they are converted to bool. GitOrigin-RevId: a699415fa15350be1daf9718239b295f272dc3ef --- tdutils/td/utils/JsonBuilder.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tdutils/td/utils/JsonBuilder.h b/tdutils/td/utils/JsonBuilder.h index 05d245ac1..b6b25fa7a 100644 --- a/tdutils/td/utils/JsonBuilder.h +++ b/tdutils/td/utils/JsonBuilder.h @@ -301,6 +301,13 @@ class JsonScope { JsonScope &operator<<(double x) { return *this << JsonFloat(x); } + template + JsonScope &operator<<(const char (&x)[N]) { + return *this << JsonString(Slice(x)); + } + JsonScope &operator<<(const char *x) { + return *this << JsonString(Slice(x)); + } JsonScope &operator<<(Slice x) { return *this << JsonString(x); }