aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.h
diff options
context:
space:
mode:
authorJim Lawson <ucbjrl@berkeley.edu>2019-07-30 16:04:27 -0700
committerJim Lawson <ucbjrl@berkeley.edu>2019-07-30 16:04:27 -0700
commite8341d949f79e501abcf637edd3e7d409e2dd72c (patch)
tree7a2f88af3d923113c2a02eaa23d663b474b21cd2 /kernel/rtlil.h
parentc66b7402c06455535bb43ee65fe20515b5b9c0ee (diff)
parentb4f38cca77a78884ce215190935af78cae92c4db (diff)
downloadyosys-e8341d949f79e501abcf637edd3e7d409e2dd72c.tar.gz
yosys-e8341d949f79e501abcf637edd3e7d409e2dd72c.tar.bz2
yosys-e8341d949f79e501abcf637edd3e7d409e2dd72c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'kernel/rtlil.h')
-rw-r--r--kernel/rtlil.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 82cbfaf28..712250b3e 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;
}
};