下载
中文
注册

Compare结构体

结构体功能

比较请求体对象的序列号大小,根据第一个参数请求体数据类型进行区分。若请求体序列号类似为string类型,则比较请求体对象序列号的hash值大小;若请求体序列号对象为数字类型,则比较其数学大小。最后返回两个请求体的数学大小关系,若结果为true,第一个参数的请求对象序列号值大;若为false,第一个参数的请求体对象序列号值小于等于第二个参数请求体对象序列号值。

结构体格式

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();
            }
        }
 };

结构体参数

无。