summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-07-27 10:41:06 +0200
committerClifford Wolf <clifford@clifford.at>2014-07-27 11:18:30 +0200
commitd088854b47f5f77c6a62be2ba4b895164938d7a2 (patch)
treeb033fa207b84a932775575c020679946bdff47cc /kernel
parent1c8fdaeef86d6e33668e325556380bfa67ec0a6f (diff)
Added conversion from ObjRange to std::vector and std::set
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index be282270..2fbfe804 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<T> begin() { return RTLIL::ObjIterator<T>(list_p, refcount_p); }
RTLIL::ObjIterator<T> end() { return RTLIL::ObjIterator<T>(); }
+
+ operator std::set<T>() const {
+ std::set<T> result;
+ for (auto &it : *list_p)
+ result.insert(it.second);
+ return result;
+ }
+
+ operator std::vector<T>() const {
+ std::vector<T> result;
+ result.reserve(list_p->size());
+ for (auto &it : *list_p)
+ result.push_back(it.second);
+ return result;
+ }
};
};