mirror of
https://github.com/nlohmann/json.git
synced 2026-04-27 02:09:26 +00:00
this should fix #28
This commit is contained in:
100
src/json.cc
100
src/json.cc
@@ -1446,11 +1446,25 @@ json::iterator::iterator(json* j) : object_(j)
|
||||
{
|
||||
if (object_->type_ == json::value_type::array)
|
||||
{
|
||||
vi_ = new array_t::iterator(object_->value_.array->begin());
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
vi_ = new array_t::iterator(object_->value_.array->begin());
|
||||
}
|
||||
}
|
||||
if (object_->type_ == json::value_type::object)
|
||||
else if (object_->type_ == json::value_type::object)
|
||||
{
|
||||
oi_ = new object_t::iterator(object_->value_.object->begin());
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi_ = new object_t::iterator(object_->value_.object->begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1461,11 +1475,25 @@ json::iterator::iterator(const json::iterator& o) : object_(o.object_)
|
||||
{
|
||||
if (object_->type_ == json::value_type::array)
|
||||
{
|
||||
vi_ = new array_t::iterator(*(o.vi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
vi_ = new array_t::iterator(object_->value_.array->begin());
|
||||
}
|
||||
}
|
||||
if (object_->type_ == json::value_type::object)
|
||||
else if (object_->type_ == json::value_type::object)
|
||||
{
|
||||
oi_ = new object_t::iterator(*(o.oi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi_ = new object_t::iterator(object_->value_.object->begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1639,11 +1667,25 @@ json::const_iterator::const_iterator(const json* j) : object_(j)
|
||||
{
|
||||
if (object_->type_ == json::value_type::array)
|
||||
{
|
||||
vi_ = new array_t::const_iterator(object_->value_.array->begin());
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
vi_ = new array_t::const_iterator(object_->value_.array->begin());
|
||||
}
|
||||
}
|
||||
if (object_->type_ == json::value_type::object)
|
||||
else if (object_->type_ == json::value_type::object)
|
||||
{
|
||||
oi_ = new object_t::const_iterator(object_->value_.object->begin());
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi_ = new object_t::const_iterator(object_->value_.object->begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1654,11 +1696,25 @@ json::const_iterator::const_iterator(const json::const_iterator& o) : object_(o.
|
||||
{
|
||||
if (object_->type_ == json::value_type::array)
|
||||
{
|
||||
vi_ = new array_t::const_iterator(*(o.vi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
vi_ = new array_t::const_iterator(object_->value_.array->begin());
|
||||
}
|
||||
}
|
||||
if (object_->type_ == json::value_type::object)
|
||||
else if (object_->type_ == json::value_type::object)
|
||||
{
|
||||
oi_ = new object_t::const_iterator(*(o.oi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi_ = new object_t::const_iterator(object_->value_.object->begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1669,11 +1725,25 @@ json::const_iterator::const_iterator(const json::iterator& o) : object_(o.object
|
||||
{
|
||||
if (object_->type_ == json::value_type::array)
|
||||
{
|
||||
vi_ = new array_t::const_iterator(*(o.vi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
vi_ = new array_t::const_iterator(object_->value_.array->begin());
|
||||
}
|
||||
}
|
||||
if (object_->type_ == json::value_type::object)
|
||||
else if (object_->type_ == json::value_type::object)
|
||||
{
|
||||
oi_ = new object_t::const_iterator(*(o.oi_));
|
||||
if (object_->empty())
|
||||
{
|
||||
object_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi_ = new object_t::const_iterator(object_->value_.object->begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user