Skip to content

Commit

Permalink
🚨 fix shadowing compiler warnings (#620)
Browse files Browse the repository at this point in the history
## Description

Fixes a couple of small shadowing compiler warnings that were introduced
in a recent PR.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

- [x] The pull request only contains commits that are related to it.
- [x] I have added appropriate tests and documentation.
- [x] I have made sure that all CI jobs on GitHub pass.
- [x] The pull request introduces no new warnings and follows the
project's style guidelines.
  • Loading branch information
burgholzer authored May 31, 2024
1 parent 386f5be commit 4db8776
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
15 changes: 7 additions & 8 deletions include/mqt-core/operations/AodOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ struct SingleOperation {
qc::fp start;
qc::fp end;

SingleOperation(Dimension dir, qc::fp start, qc::fp end)
: dir(dir), start(start), end(end) {}
SingleOperation(const Dimension d, const qc::fp s, const qc::fp e)
: dir(d), start(s), end(e) {}

[[nodiscard]] std::string toQASMString() const {
std::stringstream ss;
Expand All @@ -41,21 +41,20 @@ class AodOperation : public qc::Operation {

public:
AodOperation() = default;
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
const std::vector<Dimension>& dirs,
const std::vector<qc::fp>& starts,
const std::vector<qc::fp>& ends);
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
const std::vector<uint32_t>& dirs,
const std::vector<qc::fp>& starts,
const std::vector<qc::fp>& ends);
AodOperation(const std::string& type, std::vector<qc::Qubit> targets,
AodOperation(const std::string& typeName, std::vector<qc::Qubit> qubits,
const std::vector<uint32_t>& dirs,
const std::vector<qc::fp>& starts,
const std::vector<qc::fp>& ends);
AodOperation(
qc::OpType type, std::vector<qc::Qubit> targets,
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& operations);
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& ops);
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
std::vector<SingleOperation> operations);

Expand Down
18 changes: 9 additions & 9 deletions src/operations/AodOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ AodOperation::AodOperation(const qc::OpType s, std::vector<qc::Qubit> qubits,
}
}

AodOperation::AodOperation(const std::string& type,
std::vector<qc::Qubit> targets,
AodOperation::AodOperation(const std::string& typeName,
std::vector<qc::Qubit> qubits,
const std::vector<uint32_t>& dirs,
const std::vector<qc::fp>& start,
const std::vector<qc::fp>& end)
: AodOperation(qc::OP_NAME_TO_TYPE.at(type), std::move(targets),
: AodOperation(qc::OP_NAME_TO_TYPE.at(typeName), std::move(qubits),
convertToDimension(dirs), start, end) {}

AodOperation::AodOperation(
qc::OpType s, std::vector<qc::Qubit> targets,
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& operations) {
const qc::OpType s, std::vector<qc::Qubit> qubits,
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& ops) {
type = s;
this->targets = std::move(targets);
targets = std::move(qubits);
name = toString(type);

for (const auto& [dir, index, param] : operations) {
this->operations.emplace_back(dir, index, param);
for (const auto& [dir, index, param] : ops) {
operations.emplace_back(dir, index, param);
}
}

AodOperation::AodOperation(qc::OpType s, std::vector<qc::Qubit> t,
std::vector<SingleOperation> ops)
: operations(std::move(ops)) {
type = s;
this->targets = std::move(t);
targets = std::move(t);
name = toString(type);
}

Expand Down

0 comments on commit 4db8776

Please sign in to comment.