aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-25 19:52:23 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-25 19:52:23 +0100
commit07d0b1d07bb52e7b509b6f66836e56aa644532ab (patch)
tree9186527c794a0478f0947a224e5c03f7b3faba0b
parent4b620a45ea7960dfe2833e78f92a5990a49927f5 (diff)
BarChart: updated index resetting algorithm (using std::iota).
-rw-r--r--barchart.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/barchart.cpp b/barchart.cpp
index 8bc3ee9..343c3ef 100644
--- a/barchart.cpp
+++ b/barchart.cpp
@@ -1,6 +1,7 @@
#include "barchart.h"
#include <algorithm>
+#include <numeric>
#include <QOpenGLPaintDevice>
#include <QPainter>
@@ -58,11 +59,7 @@ void BarChart::setValues(const arma::vec &values)
m_scale.setDomain(m_values.min(), m_values.max());
m_colorScale.setExtents(m_values.min(), m_values.max());
- for (std::vector<int>::size_type i = 0;
- i < m_originalIndices.size(); i++) {
- m_originalIndices[i] = i;
- }
-
+ std::iota(m_originalIndices.begin(), m_originalIndices.end(), 0);
std::sort(m_originalIndices.begin(), m_originalIndices.end(),
[this](int i, int j) { return m_values[i] > m_values[j]; });
}