From 60eecba2264904864b37a9e0f62c521123c83a67 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 11 Sep 2020 17:16:31 +0200 Subject: [PATCH] Make NumericId hashable --- src/sfizz/utility/NumericId.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sfizz/utility/NumericId.h b/src/sfizz/utility/NumericId.h index 5abd906f..73d0b12f 100644 --- a/src/sfizz/utility/NumericId.h +++ b/src/sfizz/utility/NumericId.h @@ -5,6 +5,8 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #pragma once +#include "../StringViewHelpers.h" +#include /** * @brief Numeric identifier @@ -50,3 +52,12 @@ struct NumericId { private: int number_ = -1; }; + +namespace std { + template struct hash> { + size_t operator()(const NumericId &id) const + { + return hashNumber(id.number()); + } + }; +}