Returning a non constant reference is not possible; this allows
outside code to invalidate internal invariants (sorted order of
points) by modifying the returned point. To make updates the current
best approach is to remove the point by index, and then add it again.
AddPoint() now searches (binary search) for the best place to insert a
new point, thus always maintaining the order of Points. Therefore,
ReorderPoints() is no longer needed.
CAVEAT: This breaks if some outside code changes (the public member)
Points!
With few points the performance doesn't differ that much; using
std::sort removes the possibility of introducing bugs into the
handmade sorting algorithm, though.
GetInt(), GetLong() are exactly the same as GetValue() except that
their result is rounded and converted to the repsective data type.
Thus avoid code duplication and use GetValue().
The previous values do not influence the return value of the function
nor does looping over them have any side effect.
The next_repeats value is not used in any way, thus it doesn't need to
be calculated.
`Json::Reader` has been deprecated for some time, so we replace it with
`Json::CharReader` generated by a `Json::CharReaderBuilder`, or (in the
one instance where we have a stream as input) `Json::parseFromStream();`