Compare Structure

Function

Compares the sequence numbers of request bodies based on the data type of the first parameter request body.

  • If the sequence number is of the string type, the hash values of the sequence numbers of request body objects are compared.
  • If the sequence number is of the numeric type, the numeric values are compared.

Then, it returns the sequence number relationship between the two request bodies. If the result is true, the sequence number of the first parameter is greater than that of the second parameter. If the result is false, the sequence number of the first parameter is less than or equal to that of the second parameter.

Format

struct Compare {
        bool operator () (const InferRequestId &lhs, const InferRequestId &rhs) const
        {
            if (lhs.Type() == InferRequestId::DataType::STRING) {
                return std::hash<std::string>()(lhs.StringValue()) < std::hash<std::string>()(rhs.StringValue());
            } else {
                return lhs.UnsignedIntValue() < rhs.UnsignedIntValue();
            }
        }
 };

Parameters

None.