3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-30 21:19:30 +00:00

hashlib: add insertion order const iterator

This commit is contained in:
Emil J. Tywoniak 2025-09-02 18:21:30 +02:00
parent 430adb3b59
commit d6d1f16c43
2 changed files with 25 additions and 4 deletions

View file

@ -21,6 +21,7 @@
// do not depend on any other components of yosys (except stuff like log_*).
#include "kernel/yosys.h"
#include <iterator>
#ifndef UTILS_H
#define UTILS_H
@ -276,6 +277,16 @@ inline int ceil_log2(int x)
#endif
}
template <typename T>
auto reversed(const T& container) {
struct reverse_view {
const T& cont;
auto begin() const { return cont.rbegin(); }
auto end() const { return cont.rend(); }
};
return reverse_view{container};
}
YOSYS_NAMESPACE_END
#endif