From a35ea081de58b60523121bbf13f8f8cec1469fc2 Mon Sep 17 00:00:00 2001 From: bcumming <bcumming@cscs.ch> Date: Thu, 18 Aug 2016 09:48:24 +0200 Subject: [PATCH] fix warnings in algorithms and their tests --- src/algorithms.hpp | 7 ++++--- tests/unit/test_algorithms.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/algorithms.hpp b/src/algorithms.hpp index 5456417d..37eeaf37 100644 --- a/src/algorithms.hpp +++ b/src/algorithms.hpp @@ -139,8 +139,9 @@ std::vector<typename C::value_type> child_count(const C& parent_index) template<typename C> bool has_contiguous_compartments(const C& parent_index) { + using value_type = typename C::value_type; static_assert( - std::is_integral<typename C::value_type>::value, + std::is_integral<value_type>::value, "integral type required" ); @@ -149,9 +150,9 @@ bool has_contiguous_compartments(const C& parent_index) } auto num_child = child_count(parent_index); - for (auto i = 1u; i < parent_index.size(); ++i) { + for (auto i=1u; i < parent_index.size(); ++i) { auto p = parent_index[i]; - if (num_child[p] == 1 && p != i-1) { + if (num_child[p]==1 && p!=value_type(i-1)) { return false; } } diff --git a/tests/unit/test_algorithms.cpp b/tests/unit/test_algorithms.cpp index ebe19c37..2e82bcc9 100644 --- a/tests/unit/test_algorithms.cpp +++ b/tests/unit/test_algorithms.cpp @@ -244,9 +244,9 @@ TEST(algorithms, has_contiguous_compartments) // // 0 - // / \ + // / \. // 1 2 - // / \ + // / \. // 3 4 // EXPECT_TRUE( -- GitLab