fix int->double->int conversion in JsonInt
parent
73baf7e677
commit
6de4c29e76
|
@ -158,7 +158,7 @@ protected:
|
||||||
|
|
||||||
class JsonDouble final : public Value<Json::NUMBER, double> {
|
class JsonDouble final : public Value<Json::NUMBER, double> {
|
||||||
double number_value() const override { return m_value; }
|
double number_value() const override { return m_value; }
|
||||||
int int_value() const override { return m_value; }
|
int int_value() const override { return static_cast<int>(m_value); }
|
||||||
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
|
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
|
||||||
bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
|
bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
|
||||||
public:
|
public:
|
||||||
|
@ -171,7 +171,7 @@ class JsonInt final : public Value<Json::NUMBER, int> {
|
||||||
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
|
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
|
||||||
bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
|
bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
|
||||||
public:
|
public:
|
||||||
explicit JsonInt(double value) : Value(value) {}
|
explicit JsonInt(int value) : Value(value) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class JsonBoolean final : public Value<Json::BOOL, bool> {
|
class JsonBoolean final : public Value<Json::BOOL, bool> {
|
||||||
|
|
Loading…
Reference in New Issue