|
DQCsim
|
Represents a qubit. More...
Public Member Functions | |
| QubitRef (QubitIndex index) | |
| Wraps a raw reference. More... | |
| QubitRef (const QubitRef &)=default | |
| Default copy constructor. | |
| QubitRef & | operator= (const QubitRef &)=default |
| Default copy assignment. | |
| QubitRef (QubitRef &&)=default | |
| Default move constructor. | |
| QubitRef & | operator= (QubitRef &&)=default |
| Default move assignment. | |
| bool | operator== (const QubitRef &other) const noexcept |
| Qubit reference equality operator. More... | |
| bool | operator!= (const QubitRef &other) const noexcept |
| Qubit reference inequality operator. More... | |
| QubitIndex | get_index () const noexcept |
| Returns the raw qubit index. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const QubitRef &qubit) |
| Allow qubit references to be printed. More... | |
Represents a qubit.
This is a wrapper around the QubitIndex type, which prevents mutation and mathematical operations that don't make sense.
DQCsim's C++ API expects and gives out qubit references in this form. You can convert between it and QubitIndexes using the constructor and the get_index function as you please. Note that there is no performance difference between one or the other as they both represent a 64-bit integer in memory; this class purely adds some type-safety.
If you have the dqcsim::wrap namespace in scope, a custom literal is available for qubit references: instead of QubitRef(33) you can type 33_q as well.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
friend |