constexpr valid_t() : valid_t(false) {}
explicit constexpr valid_t(bool b)
: valid_int(b), valid_outer(b), valid_ghosts(b) {}
friend constexpr valid_t operator~(const valid_t &x) {
valid_t r;
r.valid_int = !x.valid_int;
r.valid_outer = !x.valid_outer;
r.valid_ghosts = !x.valid_ghosts;
return r;
}
friend constexpr valid_t operator&(const valid_t &x, const valid_t &y) {
valid_t r;
r.valid_int = x.valid_int && y.valid_int;
r.valid_outer = x.valid_outer && y.valid_outer;
r.valid_ghosts = x.valid_ghosts && y.valid_ghosts;
return r;
}
friend constexpr valid_t operator|(const valid_t &x, const valid_t &y) {
valid_t r;
r.valid_int = x.valid_int || y.valid_int;
r.valid_outer = x.valid_outer || y.valid_outer;
r.valid_ghosts = x.valid_ghosts || y.valid_ghosts;
return r;
}
valid_t &operator&=(const valid_t &x) { return *this = *this & x; }
valid_t &operator|=(const valid_t &x) { return *this = *this | x; }
constexpr bool all() const {
return valid_int && valid_outer && valid_ghosts;
}
constexpr bool any() const {
return valid_int || valid_outer || valid_ghosts;
}