ClickHouse/dbms/include/DB/Storages/MergeTree/BoolMask.h
2016-06-07 11:23:15 +03:00

25 lines
725 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/// Множество значений булевой переменной. То есть два булевых значения: может ли быть true, может ли быть false.
struct BoolMask
{
bool can_be_true;
bool can_be_false;
BoolMask() {}
BoolMask(bool can_be_true_, bool can_be_false_) : can_be_true(can_be_true_), can_be_false(can_be_false_) {}
BoolMask operator &(const BoolMask & m)
{
return BoolMask(can_be_true && m.can_be_true, can_be_false || m.can_be_false);
}
BoolMask operator |(const BoolMask & m)
{
return BoolMask(can_be_true || m.can_be_true, can_be_false && m.can_be_false);
}
BoolMask operator !()
{
return BoolMask(can_be_false, can_be_true);
}
};