diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-07-27 10:41:06 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-07-27 11:18:30 +0200 |
commit | d088854b47f5f77c6a62be2ba4b895164938d7a2 (patch) | |
tree | b033fa207b84a932775575c020679946bdff47cc /kernel/rtlil.h | |
parent | 1c8fdaeef86d6e33668e325556380bfa67ec0a6f (diff) | |
download | yosys-d088854b47f5f77c6a62be2ba4b895164938d7a2.tar.gz yosys-d088854b47f5f77c6a62be2ba4b895164938d7a2.tar.bz2 yosys-d088854b47f5f77c6a62be2ba4b895164938d7a2.zip |
Added conversion from ObjRange to std::vector and std::set
Diffstat (limited to 'kernel/rtlil.h')
-rw-r--r-- | kernel/rtlil.h | 15 |
1 files changed, 15 insertions, 0 deletions
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<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; + } }; }; |