libboloq
A library to replesent binary functions using Binary Decision Diagram.
 全て クラス 名前空間 関数 型定義 ページ
index_generator.h
1 #pragma once
2 
3 namespace boloq {
4 
8 template<class KT, class IT>
10  using key_type = KT;
11  using index_type = IT;
12 
13  std::unordered_map<key_type, index_type> index_table;
14 
15 public:
16 
17  explicit index_generator() = default;
18  explicit index_generator(const size_t n) {
19  index_table.reserve(n);
20  }
21 
25  index_type get_index(const key_type& key) {
26  const auto it = index_table.find(key);
27  if (it != index_table.end()) {
28  return it->second;
29  }
30  const index_type new_index = index_table.size();
31  return index_table[key] = new_index;
32  }
33 };
34 
35 }
boloq の名前空間
Definition: boolean_function.h:3
index_type get_index(const key_type &key)
インデックスを生成します
Definition: index_generator.h:25
ノードのインデックスを一意になるように生成します
Definition: index_generator.h:9