Merge remote-tracking branch 'origin/master' into xaig
[yosys.git] / kernel / utils.h
index 479effdc98805bec8a26a745b13796f728ef9a76..8942905fe3584af5ff0fa39c6d2e3a63c3eac035 100644 (file)
@@ -2,11 +2,11 @@
  *  yosys -- Yosys Open SYnthesis Suite
  *
  *  Copyright (C) 2012  Clifford Wolf <clifford@clifford.at>
- *  
+ *
  *  Permission to use, copy, modify, and/or distribute this software for any
  *  purpose with or without fee is hereby granted, provided that the above
  *  copyright notice and this permission notice appear in all copies.
- *  
+ *
  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  *  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  *  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -31,17 +31,17 @@ YOSYS_NAMESPACE_BEGIN
 // A map-like container, but you can save and restore the state
 // ------------------------------------------------
 
-template<typename Key, typename T, typename Compare = std::less<Key>>
+template<typename Key, typename T, typename OPS = hash_ops<Key>>
 struct stackmap
 {
 private:
-       std::vector<std::map<Key, T*, Compare>> backup_state;
-       std::map<Key, T, Compare> current_state;
+       std::vector<dict<Key, T*, OPS>> backup_state;
+       dict<Key, T, OPS> current_state;
        static T empty_tuple;
 
 public:
        stackmap() { }
-       stackmap(const std::map<Key, T, Compare> &other) : current_state(other) { }
+       stackmap(const dict<Key, T, OPS> &other) : current_state(other) { }
 
        template<typename Other>
        void operator=(const Other &other)
@@ -94,7 +94,7 @@ public:
                current_state.erase(k);
        }
 
-       const std::map<Key, T, Compare> &stdmap()
+       const dict<Key, T, OPS> &stdmap()
        {
                return current_state;
        }
@@ -186,7 +186,7 @@ struct TopoSort
                                active_stack.pop_back();
                        active_cells.erase(n);
                }
-               
+
                marked_cells.insert(n);
                sorted.push_back(n);
        }