Skip to content

Commit 4db8776

Browse files
authored
🚨 fix shadowing compiler warnings (cda-tum#620)
## 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.
1 parent 386f5be commit 4db8776

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

include/mqt-core/operations/AodOperation.hpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct SingleOperation {
2424
qc::fp start;
2525
qc::fp end;
2626

27-
SingleOperation(Dimension dir, qc::fp start, qc::fp end)
28-
: dir(dir), start(start), end(end) {}
27+
SingleOperation(const Dimension d, const qc::fp s, const qc::fp e)
28+
: dir(d), start(s), end(e) {}
2929

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

4242
public:
4343
AodOperation() = default;
44-
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
44+
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
4545
const std::vector<Dimension>& dirs,
4646
const std::vector<qc::fp>& starts,
4747
const std::vector<qc::fp>& ends);
48-
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
48+
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
4949
const std::vector<uint32_t>& dirs,
5050
const std::vector<qc::fp>& starts,
5151
const std::vector<qc::fp>& ends);
52-
AodOperation(const std::string& type, std::vector<qc::Qubit> targets,
52+
AodOperation(const std::string& typeName, std::vector<qc::Qubit> qubits,
5353
const std::vector<uint32_t>& dirs,
5454
const std::vector<qc::fp>& starts,
5555
const std::vector<qc::fp>& ends);
56-
AodOperation(
57-
qc::OpType type, std::vector<qc::Qubit> targets,
58-
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& operations);
56+
AodOperation(qc::OpType s, std::vector<qc::Qubit> qubits,
57+
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& ops);
5958
AodOperation(qc::OpType type, std::vector<qc::Qubit> targets,
6059
std::vector<SingleOperation> operations);
6160

src/operations/AodOperation.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,31 @@ AodOperation::AodOperation(const qc::OpType s, std::vector<qc::Qubit> qubits,
4545
}
4646
}
4747

48-
AodOperation::AodOperation(const std::string& type,
49-
std::vector<qc::Qubit> targets,
48+
AodOperation::AodOperation(const std::string& typeName,
49+
std::vector<qc::Qubit> qubits,
5050
const std::vector<uint32_t>& dirs,
5151
const std::vector<qc::fp>& start,
5252
const std::vector<qc::fp>& end)
53-
: AodOperation(qc::OP_NAME_TO_TYPE.at(type), std::move(targets),
53+
: AodOperation(qc::OP_NAME_TO_TYPE.at(typeName), std::move(qubits),
5454
convertToDimension(dirs), start, end) {}
5555

5656
AodOperation::AodOperation(
57-
qc::OpType s, std::vector<qc::Qubit> targets,
58-
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& operations) {
57+
const qc::OpType s, std::vector<qc::Qubit> qubits,
58+
const std::vector<std::tuple<Dimension, qc::fp, qc::fp>>& ops) {
5959
type = s;
60-
this->targets = std::move(targets);
60+
targets = std::move(qubits);
6161
name = toString(type);
6262

63-
for (const auto& [dir, index, param] : operations) {
64-
this->operations.emplace_back(dir, index, param);
63+
for (const auto& [dir, index, param] : ops) {
64+
operations.emplace_back(dir, index, param);
6565
}
6666
}
6767

6868
AodOperation::AodOperation(qc::OpType s, std::vector<qc::Qubit> t,
6969
std::vector<SingleOperation> ops)
7070
: operations(std::move(ops)) {
7171
type = s;
72-
this->targets = std::move(t);
72+
targets = std::move(t);
7373
name = toString(type);
7474
}
7575

0 commit comments

Comments
 (0)