本文整理汇总了C++中Predicate::orLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::orLeft方法的具体用法?C++ Predicate::orLeft怎么用?C++ Predicate::orLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::orLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: andLeft
bool Predicate::operator==(const Predicate& other) const {
if (kind() != other.kind()) {
return false;
}
switch (kind()) {
case TRUE:
case FALSE:
case SELFCONST:
{
return true;
}
case AND:
{
return andLeft() == other.andLeft() && andRight() == other.andRight();
}
case OR:
{
return orLeft() == other.orLeft() && orRight() == other.orRight();
}
case SATISFIES:
{
return satisfiesType() == other.satisfiesType() &&
satisfiesRequirement() == other.satisfiesRequirement();
}
case VARIABLE:
{
return variableTemplateVar() == other.variableTemplateVar();
}
}
locic_unreachable("Unknown predicate kind.");
}
示例2: Or
Predicate Predicate::Or(Predicate left, Predicate right) {
if (left.isTrue() || right.isTrue()) {
return Predicate::True();
} else if (left.isFalse()) {
return right;
} else if (right.isFalse()) {
return left;
} else if (left == right) {
return left;
} else if (left.isOr() && (left.orLeft() == right || left.orRight() == right)) {
return left;
} else if (right.isOr() && (right.orLeft() == left || right.orRight() == left)) {
return right;
}
Predicate predicate(OR);
predicate.left_ = std::unique_ptr<Predicate>(new Predicate(std::move(left)));
predicate.right_ = std::unique_ptr<Predicate>(new Predicate(std::move(right)));
return predicate;
}