From d088854b47f5f77c6a62be2ba4b895164938d7a2 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 27 Jul 2014 10:41:06 +0200 Subject: [PATCH] Added conversion from ObjRange to std::vector and std::set --- kernel/rtlil.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index be2822706..2fbfe8049 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -268,6 +268,21 @@ namespace RTLIL ObjRange(decltype(list_p) list_p, int *refcount_p) : list_p(list_p), refcount_p(refcount_p) { } RTLIL::ObjIterator begin() { return RTLIL::ObjIterator(list_p, refcount_p); } RTLIL::ObjIterator end() { return RTLIL::ObjIterator(); } + + operator std::set() const { + std::set result; + for (auto &it : *list_p) + result.insert(it.second); + return result; + } + + operator std::vector() const { + std::vector result; + result.reserve(list_p->size()); + for (auto &it : *list_p) + result.push_back(it.second); + return result; + } }; }; -- 2.30.2