From 1bb509897c77b7a8931f10b84dc1de98668c04bd Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 13 Oct 2020 10:07:28 +0100 Subject: nexus: More pin styles and FASM pinmux gen Signed-off-by: David Shah --- common/util.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common') diff --git a/common/util.h b/common/util.h index d82e984a..07ebac75 100644 --- a/common/util.h +++ b/common/util.h @@ -121,6 +121,15 @@ template std::map sorted_ref(std::unordered_map return retVal; }; +// Wrap an unordered_map, and allow it to be iterated over sorted by key +template std::map sorted_cref(const std::unordered_map &orig) +{ + std::map retVal; + for (auto &item : orig) + retVal.emplace(std::make_pair(item.first, std::ref(item.second))); + return retVal; +}; + // Wrap an unordered_set, and allow it to be iterated over sorted by key template std::set sorted(const std::unordered_set &orig) { -- cgit v1.2.3