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:
parent
430adb3b59
commit
d6d1f16c43
2 changed files with 25 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue