pairinteraction
A Rydberg Interaction Calculator
Parity.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Pairinteraction Developers
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
6#include <functional>
7#include <iostream>
8#include <stdexcept>
9
10namespace pairinteraction {
11enum class Parity : int { ODD = -1, EVEN = 1, UNKNOWN = 2 };
12
13inline std::ostream &operator<<(std::ostream &os, const Parity &parity) {
14 if (parity == Parity::ODD) {
15 return os << "-1";
16 }
17 if (parity == Parity::EVEN) {
18 return os << "1";
19 }
20 throw std::runtime_error("Cannot print unknown parity.");
21}
22} // namespace pairinteraction
std::ostream & operator<<(std::ostream &os, const Parity &parity)
Definition: Parity.hpp:13