mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
fix
In value.h, ValueConstIterator can convert to ValueIterator, I think that is a bug. the correct way is ValueIterator can convert to ValueConstIterator.
This commit is contained in:
parent
4994c77d09
commit
c8a8cfcd4b
@ -738,6 +738,7 @@ public:
|
|||||||
typedef ValueConstIterator SelfType;
|
typedef ValueConstIterator SelfType;
|
||||||
|
|
||||||
ValueConstIterator();
|
ValueConstIterator();
|
||||||
|
ValueConstIterator(ValueIterator const& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*! \internal Use by Value to create an iterator.
|
/*! \internal Use by Value to create an iterator.
|
||||||
@ -787,7 +788,7 @@ public:
|
|||||||
typedef ValueIterator SelfType;
|
typedef ValueIterator SelfType;
|
||||||
|
|
||||||
ValueIterator();
|
ValueIterator();
|
||||||
ValueIterator(const ValueConstIterator& other);
|
explicit ValueIterator(const ValueConstIterator& other);
|
||||||
ValueIterator(const ValueIterator& other);
|
ValueIterator(const ValueIterator& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -129,6 +129,9 @@ ValueConstIterator::ValueConstIterator(
|
|||||||
const Value::ObjectValues::iterator& current)
|
const Value::ObjectValues::iterator& current)
|
||||||
: ValueIteratorBase(current) {}
|
: ValueIteratorBase(current) {}
|
||||||
|
|
||||||
|
ValueConstIterator::ValueConstIterator(ValueIterator const& other)
|
||||||
|
: ValueIteratorBase(other) {}
|
||||||
|
|
||||||
ValueConstIterator& ValueConstIterator::
|
ValueConstIterator& ValueConstIterator::
|
||||||
operator=(const ValueIteratorBase& other) {
|
operator=(const ValueIteratorBase& other) {
|
||||||
copy(other);
|
copy(other);
|
||||||
@ -149,7 +152,9 @@ ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
|
|||||||
: ValueIteratorBase(current) {}
|
: ValueIteratorBase(current) {}
|
||||||
|
|
||||||
ValueIterator::ValueIterator(const ValueConstIterator& other)
|
ValueIterator::ValueIterator(const ValueConstIterator& other)
|
||||||
: ValueIteratorBase(other) {}
|
: ValueIteratorBase(other) {
|
||||||
|
throwRuntimeError("ConstIterator to Iterator should never be allowed.");
|
||||||
|
}
|
||||||
|
|
||||||
ValueIterator::ValueIterator(const ValueIterator& other)
|
ValueIterator::ValueIterator(const ValueIterator& other)
|
||||||
: ValueIteratorBase(other) {}
|
: ValueIteratorBase(other) {}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
// Make numeric limits more convenient to talk about.
|
// Make numeric limits more convenient to talk about.
|
||||||
@ -2436,7 +2435,9 @@ JSONTEST_FIXTURE(IteratorTest, indexes) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE(IteratorTest, const) {
|
JSONTEST_FIXTURE(IteratorTest, const) {
|
||||||
Json::Value const v;
|
Json::Value const v;
|
||||||
Json::Value::iterator it = v.begin(); // This *should not* compile, but does.
|
JSONTEST_ASSERT_THROWS(
|
||||||
|
Json::Value::iterator it(v.begin()) // Compile, but throw.
|
||||||
|
);
|
||||||
|
|
||||||
Json::Value value;
|
Json::Value value;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user