aboutsummaryrefslogtreecommitdiffstats
path: root/src/lesson40_algo12.cpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-05-03 17:05:38 +0200
committerSven Göthel <[email protected]>2024-05-03 17:05:38 +0200
commit18d2e004a17a9ecc4ffc2b511e1ed287c85b28c0 (patch)
treed7c8dfa7764a68ba52f6efb02c13bc2b7c9bab18 /src/lesson40_algo12.cpp
parentc965ba96c0c714e1a84902c71f3e8aa7da020b6a (diff)
Resolve clang-tidy warnings=error; Notable std::vector<>: size() -> size_t (unsigned) but iterator and difference_type are signed and losing half of range
Because std::vector<>::begin() iterator performs arithmetic using a signed difference_type, we need to use such a signed type here to avoid `bugprone-narrowing-conversions` (LINT) Now, isn't this odd as std::vector<>::size() uses unsigned size_type, aka size_t and mentioned iterator hence lose half the value range possible?
Diffstat (limited to 'src/lesson40_algo12.cpp')
-rw-r--r--src/lesson40_algo12.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lesson40_algo12.cpp b/src/lesson40_algo12.cpp
index 532f696..bdf2c7b 100644
--- a/src/lesson40_algo12.cpp
+++ b/src/lesson40_algo12.cpp
@@ -30,10 +30,10 @@ namespace test_env {
public:
constexpr ValueType() noexcept
- : store(0) { }
+ : store(0) {}
constexpr ValueType(int64_t v) noexcept
- : store(v) { }
+ : store(v) {}
constexpr ValueType(const ValueType& o) noexcept = default;
constexpr ValueType(ValueType&& o) noexcept = default;
@@ -381,7 +381,7 @@ void test_qsort(const std::string& prefix, qsort_func qsort, test_vector_t has,
dumpVec(prefix+"b", c, has);
assert( exp == has );
}
-void test_qsort(const std::string& prefix, test_vector_t has, const test_vector_t& exp) {
+void test_qsort(const std::string& prefix, const test_vector_t& has, const test_vector_t& exp) {
test_qsort("qsort-hoare_goth-"+prefix, hoare2::qsort, has, exp);
test_qsort("qsort-hoare_sedg-"+prefix, hoare1::qsort, has, exp);
test_qsort("qsort-hoare_tony-"+prefix, hoare0::qsort, has, exp);