aboutsummaryrefslogtreecommitdiffstats
path: root/CodingReadme
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-01-18 12:12:33 +0100
committerClifford Wolf <clifford@clifford.at>2015-01-18 12:12:33 +0100
commit0217ea0fb82b9170bb6efce734f1965ff2b181e7 (patch)
treefdc498f2d8c025569f27c9b466b86a775890eea8 /CodingReadme
parent61192514e3e22e196e1df5aaaf98bb2ed6fd57df (diff)
downloadyosys-0217ea0fb82b9170bb6efce734f1965ff2b181e7.tar.gz
yosys-0217ea0fb82b9170bb6efce734f1965ff2b181e7.tar.bz2
yosys-0217ea0fb82b9170bb6efce734f1965ff2b181e7.zip
Added hashlib::idict<>
Diffstat (limited to 'CodingReadme')
-rw-r--r--CodingReadme14
1 files changed, 14 insertions, 0 deletions
diff --git a/CodingReadme b/CodingReadme
index 92d54d283..78bc5a3ce 100644
--- a/CodingReadme
+++ b/CodingReadme
@@ -72,6 +72,20 @@ replacement for std::unordered_set<T>. The main characteristics are:
- dict<K, T> and pool<T> will have the same order of iteration across
all compilers, standard libraries and architectures.
+In addition to dict<K, T> and pool<T> there is also an idict<K> that
+creates a bijective map from K to the integers. For example:
+
+ idict<string, 42> si;
+ log("%d\n", si("hello")); // will print 42
+ log("%d\n", si("world")); // will print 43
+ log("%d\n", si.at("world")); // will print 43
+ log("%d\n", si.at("dummy")); // will throw exception
+ log("%s\n", si[42].c_str())); // will print hello
+ log("%s\n", si[43].c_str())); // will print world
+ log("%s\n", si[44].c_str())); // will throw exception
+
+It is not possible to remove elements from an idict.
+
2. Standard STL data types
In Yosys we use std::vector<T> and std::string whenever applicable. When