diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-08-01 12:02:16 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-01 12:02:16 -0700 |
commit | ed303b07b770c6aa4bc69f04bc517ce4701988ed (patch) | |
tree | 47eba7043cf616be11d30f8302a7036e89392965 /kernel/rtlil.h | |
parent | 7e86c8bcfb10f6a819273ad8bd10fa461987f2f1 (diff) | |
parent | e8a2d10982cd8f6ba3b0e66fbd922b051073f0cf (diff) | |
download | yosys-ed303b07b770c6aa4bc69f04bc517ce4701988ed.tar.gz yosys-ed303b07b770c6aa4bc69f04bc517ce4701988ed.tar.bz2 yosys-ed303b07b770c6aa4bc69f04bc517ce4701988ed.zip |
Merge remote-tracking branch 'origin/master' into xc7dsp
Diffstat (limited to 'kernel/rtlil.h')
-rw-r--r-- | kernel/rtlil.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 1ed055715..02bf274fb 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -420,8 +420,12 @@ namespace RTLIL // It maintains a reference counter that is used to make sure that the container is not modified while being iterated over. template<typename T> - struct ObjIterator - { + struct ObjIterator { + using iterator_category = std::forward_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; typename dict<RTLIL::IdString, T>::iterator it; dict<RTLIL::IdString, T> *list_p; int *refcount_p; @@ -474,13 +478,25 @@ namespace RTLIL return it != other.it; } - inline void operator++() { + + inline bool operator==(const RTLIL::ObjIterator<T> &other) const { + return !(*this != other); + } + + inline ObjIterator<T>& operator++() { log_assert(list_p != nullptr); if (++it == list_p->end()) { (*refcount_p)--; list_p = nullptr; refcount_p = nullptr; } + return *this; + } + + inline const ObjIterator<T> operator++(int) { + ObjIterator<T> result(*this); + ++(*this); + return result; } }; |