35 constexpr
explicit Parity(
bool is_positive)
77 inline int operator*(
const int& i)
const
86 inline explicit operator int()
const {
111 if (
static_cast<bool>(p))
return i;
115 inline std::ostream& operator<<(std::ostream& out,
const marley::Parity& p)
Type-safe representation of a parity value (either +1 or -1)
Definition: Parity.hh:25
bool is_positive_
Boolean representation of the parity value that is true when the parity is +1 and false when it is -1...
Definition: Parity.hh:104
constexpr Parity(bool is_positive)
Create a Parity object from a boolean value.
Definition: Parity.hh:35
constexpr marley::Parity operator-() const
Creates a copy of the Parity object with a flipped value.
Definition: Parity.hh:47
char to_char() const
Convert the Parity object to a char.
Definition: Parity.hh:92
void from_char(const char c)
Assign a value to this Parity object from a char.
Definition: Parity.cc:45
constexpr Parity()
Default constructor chooses positive parity.
Definition: Parity.hh:30
Parity & operator!()
Unary operator that flips a Parity value in place.
Definition: Parity.hh:52
marley::Parity & operator=(const int &i)
Assigns a parity value using an integer.
Definition: Parity.cc:34