From 8378f1a885678569b593f94ddeabea9f734de64f Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 23 Aug 2018 16:51:02 -0300 Subject: Use std::array instead of plain array. --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 5972b4d..31c8a59 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,11 +1,11 @@ #include #include +#include #include #include #include -const char *TICKS[] = {"▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"}; -const size_t NUM_TICKS = 8; +const std::array TICKS = {"▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"}; const double EPSILON = 1e-8; template @@ -18,7 +18,7 @@ void sparkify(InputIterator first, InputIterator last, OutputIterator &out) { if (values_range < EPSILON) { std::fill_n(out, last - first, TICKS[0]); } else { - auto coef = (NUM_TICKS - 1) / values_range; + auto coef = (TICKS.size() - 1) / values_range; std::transform(first, last, out, [&](auto x) { return TICKS[(size_t) round((x - min) * coef)]; }); -- cgit v1.2.3