more test cases
This commit is contained in:
parent
385865c4ec
commit
5ec433604a
2 changed files with 47 additions and 10 deletions
src
12
src/json.hpp
12
src/json.hpp
|
@ -350,7 +350,7 @@ class basic_json
|
|||
// if object is wanted but impossible, throw an exception
|
||||
if (manual_type == value_t::object and not is_object)
|
||||
{
|
||||
throw std::logic_error("cannot create JSON object");
|
||||
throw std::logic_error("cannot create JSON object from initializer list");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,15 +379,7 @@ class basic_json
|
|||
|
||||
inline static basic_json object(list_init_t l = list_init_t())
|
||||
{
|
||||
// if more than one element is in the initializer list, wrap it
|
||||
if (l.size() > 1)
|
||||
{
|
||||
return basic_json({l}, false, value_t::object);
|
||||
}
|
||||
else
|
||||
{
|
||||
return basic_json(l, false, value_t::object);
|
||||
}
|
||||
return basic_json(l, false, value_t::object);
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue