From 0217ea0fb82b9170bb6efce734f1965ff2b181e7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 18 Jan 2015 12:12:33 +0100 Subject: Added hashlib::idict<> --- CodingReadme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'CodingReadme') diff --git a/CodingReadme b/CodingReadme index 92d54d283..78bc5a3ce 100644 --- a/CodingReadme +++ b/CodingReadme @@ -72,6 +72,20 @@ replacement for std::unordered_set. The main characteristics are: - dict and pool will have the same order of iteration across all compilers, standard libraries and architectures. +In addition to dict and pool there is also an idict that +creates a bijective map from K to the integers. For example: + + idict 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 and std::string whenever applicable. When -- cgit v1.2.3