Repository: vespa-engine/vespa
File: searchlib/src/vespa/searchlib/expression/resultnodes.cpp (C++)

Code before:
void FloatResultNode::setMax() { _value = std::numeric_limits<double>::max(); }

void NullResultNode::setMin() { }
void NullResultNode::setMax() { }
void    NullResultNode::add(const ResultNode & b) { (void) b; }
void    NullResultNode::min(const ResultNode & b) { (void) b; }
void    NullResultNode::max(const ResultNode & b) { (void) b; }
int64_t NullResultNode::onGetInteger(size_t index) const { (void) index; return 0; }
double  NullResultNode::onGetFloat(size_t index)   const { (void) index; return 0.0; }
int     NullResultNode::onCmp(const Identifiable & b) const { (void) b; return (b.getClass().id() == NullResultNode::classId) ? 0 : 1; }
void    NullResultNode::set(const ResultNode & rhs) { (void) rhs; }
size_t  NullResultNode::hash() const { return 0; }
ResultNode::ConstBufferRef NullResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const { (void) index; return buf; }
void PositiveInfinityResultNode::setMin() { }
void PositiveInfinityResultNode::setMax() { }
void    PositiveInfinityResultNode::add(const ResultNode & b) { (void) b; }
void    PositiveInfinityResultNode::min(const ResultNode & b) { (void) b; }
void    PositiveInfinityResultNode::max(const ResultNode & b) { (void) b; }
int64_t PositiveInfinityResultNode::onGetInteger(size_t index) const {
    (void) index;
    return std::numeric_limits<int64_t>::infinity();
}
double  PositiveInfinityResultNode::onGetFloat(size_t index)   const {
    (void) index;
    return std::numeric_limits<double>::infinity();
}
void    PositiveInfinityResultNode::set(const ResultNode & rhs) { (void) rhs; }
size_t  PositiveInfinityResultNode::hash() const { return 0; }
ResultNode::ConstBufferRef PositiveInfinityResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const { (void) index; return buf; }

int PositiveInfinityResultNode::onCmp(const Identifiable & b) const
{
    if (b.inherits(PositiveInfinityResultNode::classId)) {
        return 0;
    }
    return 1;
}

int64_t StringResultNode::onGetInteger(size_t index) const { (void) index; return strtoll(_value.c_str(), nullptr, 0); }
double  StringResultNode::onGetFloat(size_t index)   const { (void) index; return vespalib::locale::c::strtod(_value.c_str(), nullptr); }
Serializer &
StringResultNode::onSerialize(Serializer & os) const
{
    os << _value;
    return os;
}

int
StringResultNode::onCmp(const Identifiable & b) const
{
    if (b.inherits(PositiveInfinityResultNode::classId)) {

Review comment (suggestion):
```suggestion
int64_t PositiveInfinityResultNode::onGetInteger(size_t) const {
    return std::numeric_limits<int64_t>::max();
}
double  PositiveInfinityResultNode::onGetFloat(size_t)   const {
    return std::numeric_limits<double>::infinity();
}
```

Code after:
void FloatResultNode::setMax() { _value = std::numeric_limits<double>::max(); }

void NullResultNode::setMin() { }
void NullResultNode::setMax() { }
void    NullResultNode::add(const ResultNode & b) { (void) b; }
void    NullResultNode::min(const ResultNode & b) { (void) b; }
void    NullResultNode::max(const ResultNode & b) { (void) b; }
int64_t NullResultNode::onGetInteger(size_t index) const { (void) index; return 0; }
double  NullResultNode::onGetFloat(size_t index)   const { (void) index; return 0.0; }
int     NullResultNode::onCmp(const Identifiable & b) const { (void) b; return (b.getClass().id() == NullResultNode::classId) ? 0 : 1; }
void    NullResultNode::set(const ResultNode & rhs) { (void) rhs; }
size_t  NullResultNode::hash() const { return 0; }
ResultNode::ConstBufferRef NullResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const { (void) index; return buf; }
void PositiveInfinityResultNode::setMin() { }
void PositiveInfinityResultNode::setMax() { }
void    PositiveInfinityResultNode::add(const ResultNode & b) { (void) b; }
void    PositiveInfinityResultNode::min(const ResultNode & b) { (void) b; }
void    PositiveInfinityResultNode::max(const ResultNode & b) { (void) b; }
int64_t PositiveInfinityResultNode::onGetInteger(size_t) const {
    return std::numeric_limits<int64_t>::max();
}
double  PositiveInfinityResultNode::onGetFloat(size_t)   const {
    return std::numeric_limits<double>::infinity();
}
void    PositiveInfinityResultNode::set(const ResultNode & rhs) { (void) rhs; }
size_t  PositiveInfinityResultNode::hash() const { return 0; }
ResultNode::ConstBufferRef PositiveInfinityResultNode::onGetString(size_t index, ResultNode::BufferRef buf) const { (void) index; return buf; }

int PositiveInfinityResultNode::onCmp(const Identifiable & b) const
{
    if (b.inherits(PositiveInfinityResultNode::classId)) {
        return 0;
    }
    return 1;
}

int64_t StringResultNode::onGetInteger(size_t index) const { (void) index; return strtoll(_value.c_str(), nullptr, 0); }
double  StringResultNode::onGetFloat(size_t index)   const { (void) index; return vespalib::locale::c::strtod(_value.c_str(), nullptr); }
Serializer &
StringResultNode::onSerialize(Serializer & os) const
{
    os << _value;
    return os;
}

int
StringResultNode::onCmp(const Identifiable & b) const
{
    if (b.inherits(PositiveInfinityResultNode::classId)) {
        return -1;
    } else {