From 8ed4de1ddaaf020a725888504081e696dc8c0ec7 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 20 Dec 2016 02:29:18 +0100 Subject: [PATCH] fix: Use enum_hash for unordered_map --- include/components/types.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/components/types.hpp b/include/components/types.hpp index 0271ec9a..cb751321 100644 --- a/include/components/types.hpp +++ b/include/components/types.hpp @@ -8,6 +8,13 @@ POLYBAR_NS +struct enum_hash { + template + inline typename std::enable_if::value, size_t>::type operator()(T const value) const { + return static_cast(value); + } +}; + enum class edge : uint8_t { NONE = 0U, TOP, BOTTOM, LEFT, RIGHT, ALL }; enum class alignment : uint8_t { NONE = 0U, LEFT, CENTER, RIGHT }; @@ -115,7 +122,7 @@ struct bar_settings { line_settings underline{}; line_settings overline{}; - std::unordered_map borders{}; + std::unordered_map borders{}; uint8_t spacing{1U}; string separator{};