[Language Conformance] Use constexpr restriction in jsoncpp (#1005)

* use constexpr restriction in jsoncpp

* remove TODO comment
This commit is contained in:
dota17
2019-09-17 01:33:47 +08:00
committed by Jordan Bayles
parent 3550a0a939
commit 7ef0f9fa5b
3 changed files with 18 additions and 34 deletions

View File

@@ -1548,12 +1548,11 @@ bool OurReader::decodeNumber(Token& token, Value& decoded) {
if (isNegative)
++current;
// TODO(issue #960): Change to constexpr
static const auto positive_threshold = Value::maxLargestUInt / 10;
static const auto positive_last_digit = Value::maxLargestUInt % 10;
static const auto negative_threshold =
static constexpr auto positive_threshold = Value::maxLargestUInt / 10;
static constexpr auto positive_last_digit = Value::maxLargestUInt % 10;
static constexpr auto negative_threshold =
Value::LargestUInt(Value::minLargestInt) / 10;
static const auto negative_last_digit =
static constexpr auto negative_last_digit =
Value::LargestUInt(Value::minLargestInt) % 10;
const auto threshold = isNegative ? negative_threshold : positive_threshold;