some cleanup for #83
This commit is contained in:
parent
67c2d90a21
commit
00f9296db5
3 changed files with 26 additions and 4 deletions
|
@ -6163,7 +6163,7 @@ class basic_json
|
|||
{
|
||||
private:
|
||||
/// the container to iterate
|
||||
basic_json& container;
|
||||
typename basic_json::reference container;
|
||||
/// the type of the iterator to use while iteration
|
||||
using json_iterator = decltype(std::begin(container));
|
||||
|
||||
|
@ -6236,7 +6236,7 @@ class basic_json
|
|||
|
||||
public:
|
||||
/// construct iterator wrapper from a container
|
||||
iterator_wrapper(basic_json& cont)
|
||||
iterator_wrapper(typename basic_json::reference cont)
|
||||
: container(cont)
|
||||
{}
|
||||
|
||||
|
|
|
@ -6163,7 +6163,7 @@ class basic_json
|
|||
{
|
||||
private:
|
||||
/// the container to iterate
|
||||
basic_json& container;
|
||||
typename basic_json::reference container;
|
||||
/// the type of the iterator to use while iteration
|
||||
using json_iterator = decltype(std::begin(container));
|
||||
|
||||
|
@ -6236,7 +6236,7 @@ class basic_json
|
|||
|
||||
public:
|
||||
/// construct iterator wrapper from a container
|
||||
iterator_wrapper(basic_json& cont)
|
||||
iterator_wrapper(typename basic_json::reference cont)
|
||||
: container(cont)
|
||||
{}
|
||||
|
||||
|
|
|
@ -9555,6 +9555,10 @@ TEST_CASE("iterator_wrapper")
|
|||
{
|
||||
CHECK(i.key() == "A");
|
||||
CHECK(i.value() == json(1));
|
||||
|
||||
// change the value
|
||||
i.value() = json(11);
|
||||
CHECK(i.value() == json(11));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9562,6 +9566,10 @@ TEST_CASE("iterator_wrapper")
|
|||
{
|
||||
CHECK(i.key() == "B");
|
||||
CHECK(i.value() == json(2));
|
||||
|
||||
// change the value
|
||||
i.value() = json(22);
|
||||
CHECK(i.value() == json(22));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9573,6 +9581,9 @@ TEST_CASE("iterator_wrapper")
|
|||
}
|
||||
|
||||
CHECK(counter == 3);
|
||||
|
||||
// check if values where changed
|
||||
CHECK(j == json({{"A", 11}, {"B", 22}}));
|
||||
}
|
||||
|
||||
SECTION("const value")
|
||||
|
@ -9690,6 +9701,10 @@ TEST_CASE("iterator_wrapper")
|
|||
{
|
||||
CHECK(i.key() == "0");
|
||||
CHECK(i.value() == "A");
|
||||
|
||||
// change the value
|
||||
i.value() = "AA";
|
||||
CHECK(i.value() == "AA");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9697,6 +9712,10 @@ TEST_CASE("iterator_wrapper")
|
|||
{
|
||||
CHECK(i.key() == "1");
|
||||
CHECK(i.value() == "B");
|
||||
|
||||
// change the value
|
||||
i.value() = "BB";
|
||||
CHECK(i.value() == "BB");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9708,6 +9727,9 @@ TEST_CASE("iterator_wrapper")
|
|||
}
|
||||
|
||||
CHECK(counter == 3);
|
||||
|
||||
// check if values where changed
|
||||
CHECK(j == json({"AA", "BB"}));
|
||||
}
|
||||
|
||||
SECTION("const value")
|
||||
|
|
Loading…
Reference in a new issue