@@ -34,16 +34,17 @@ namespace antithesis {
34
34
};
35
35
36
36
struct JSON ; struct JSONArray ;
37
- typedef std::variant<std::nullptr_t , std::string, bool , char , int , uint64_t , float , double , const char *, JSON , JSONArray> JSONValue;
37
+ typedef std::variant<JSON, std::nullptr_t , std::string, bool , char , int , uint64_t , float , double , const char *, JSONArray> JSONValue;
38
38
39
39
struct JSONArray : std::vector<JSONValue> {
40
40
using std::vector<JSONValue>::vector;
41
41
42
- template <typename T> requires std::convertible_to< T, JSONValue>
42
+ template <typename T, std::enable_if_t <std::is_convertible_v< T, JSONValue>, bool > = true >
43
43
JSONArray (std::vector<T> vals) : std::vector<JSONValue>(vals.begin(), vals.end()) {}
44
44
};
45
45
46
46
struct JSON : std::map<std::string, JSONValue> {
47
+ JSON () : std::map<std::string, JSONValue>() {}
47
48
JSON ( std::initializer_list<std::pair<const std::string, JSONValue>> args) : std::map<std::string, JSONValue>(args) {}
48
49
49
50
JSON ( std::initializer_list<std::pair<const std::string, JSONValue>> args, std::vector<std::pair<const std::string, JSONValue>> more_args ) : std::map<std::string, JSONValue>(args) {
@@ -299,7 +300,7 @@ namespace antithesis {
299
300
bool first = true ;
300
301
for (auto &item : arg) {
301
302
if (!first) {
302
- out << " , " ;
303
+ out << ' , ' ;
303
304
}
304
305
first = false ;
305
306
out << item;
@@ -314,18 +315,18 @@ namespace antithesis {
314
315
}
315
316
316
317
static std::ostream& operator <<(std::ostream& out, const JSON& details) {
317
- out << " { " ;
318
+ out << ' { ' ;
318
319
319
320
bool first = true ;
320
321
for (auto [key, value] : details) {
321
322
if (!first) {
322
- out << " , " ;
323
+ out << ' , ' ;
323
324
}
324
- out << std::quoted (key) << " : " << value;
325
+ out << std::quoted (key) << ' : ' << value;
325
326
first = false ;
326
327
}
327
328
328
- out << " } " ;
329
+ out << ' } ' ;
329
330
return out;
330
331
}
331
332
0 commit comments