Skip to content

Commit

Permalink
fix compile warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed May 16, 2024
1 parent 2b0800b commit 7045162
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 7 additions & 12 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef CONFIG_H
#define CONFIG_H

#include <cstdint>
#include <map>
#include <optional>
#include <string>
#include <string_view>
#include <cstdint>
#include <utility>
#include <vector>
#include <optional>
#include <variant>
#include <vector>

#include <toml.hpp>

Expand Down Expand Up @@ -65,16 +65,11 @@ template <typename T> class SpectrumSlice {
, frequency_range_(center_frequency - sample_rate / 2, center_frequency + sample_rate / 2)
, sample_rate_(sample_rate){};

friend auto operator==(const SpectrumSlice<T>&, const SpectrumSlice<T>&) -> bool;
friend auto operator!=(const SpectrumSlice<T>&, const SpectrumSlice<T>&) -> bool;
};

template <typename T> auto operator==(const SpectrumSlice<T>& lhs, const SpectrumSlice<T>& rhs) -> bool {
return lhs.center_frequency_ == rhs.center_frequency_ && lhs.sample_rate_ == rhs.sample_rate_;
};
friend auto operator==(const SpectrumSlice<T>& lhs, const SpectrumSlice<T>& rhs) -> bool {
return lhs.center_frequency_ == rhs.center_frequency_ && lhs.sample_rate_ == rhs.sample_rate_;
};

template <typename T> auto operator!=(const SpectrumSlice<T>& lhs, const SpectrumSlice<T>& rhs) -> bool {
return !operator==<T>(lhs, rhs);
friend auto operator!=(const SpectrumSlice<T>& lhs, const SpectrumSlice<T>& rhs) -> bool { return !(lhs == rhs); };
};

class Stream {
Expand Down
4 changes: 2 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ TopLevel::TopLevel(const SpectrumSlice<unsigned int>& spectrum, std::string devi
, streams_(streams)
, decimators_(decimators) {
for (const auto& stream : streams) {
if (operator!=<unsigned int>(stream.input_spectrum_, spectrum)) {
if (stream.input_spectrum_ != spectrum) {
throw std::invalid_argument("The output of Decimate does not match to the input of Stream.");
}
}
for (const auto& decimator : decimators) {
if (operator!=<unsigned int>(decimator.input_spectrum_, spectrum)) {
if (decimator.input_spectrum_ != spectrum) {
throw std::invalid_argument("The output of Decimate does not match to the input of Stream.");
}
}
Expand Down

0 comments on commit 7045162

Please sign in to comment.