只是出于好奇:如果我有一个类运算符(或函数等),它接受多个参数(通常为 1 或 2)并返回 3 个值中的 1 个(而不是布尔值 true 或 false),它是否仍应称为谓词?还是模糊逻辑的特例?要不然是啥?
例子:
template <class T>
class BinaryPredicate {
public:
virtual int operator()(const T& lhs, const T& rhs) const = 0;
};
根据定义的继承运算符函数(例如确定顺序)返回 -1、0 或 1。