Skip to content

Commit 2bf69bf

Browse files
committed
Define numberingt as the implementation
There is no need for separate a separe type alias and implementaion if numbering is always done using the same kind of map. Therefore we can use a single name instead of two, which means less to maintain.
1 parent d3f5cda commit 2bf69bf

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/util/numbering.h

+7-11
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ Author: Daniel Kroening, [email protected]
1515
#include "invariant.h"
1616
#include "optional.h"
1717

18-
/// \tparam Map: a map from a key type to some numeric type
19-
template <typename Map>
20-
class template_numberingt final
18+
/// \tparam keyt: The type of keys which will be numbered.
19+
/// \tparam hasht: The type of hashing functor used to hash keys.
20+
template <typename keyt, typename hasht = std::hash<keyt>>
21+
class numberingt final
2122
{
2223
public:
23-
using number_type = typename Map::mapped_type; // NOLINT
24-
using key_type = typename Map::key_type; // NOLINT
24+
using number_type = std::size_t; // NOLINT
25+
using key_type = keyt; // NOLINT
2526

2627
private:
2728
using data_typet = std::vector<key_type>; // NOLINT
2829
data_typet data_;
29-
Map numbers_;
30+
std::unordered_map<keyt, number_type, hasht> numbers_;
3031

3132
public:
3233
using size_type = typename data_typet::size_type; // NOLINT
@@ -108,10 +109,5 @@ class template_numberingt final
108109
}
109110
};
110111

111-
/// \tparam keyt: The type of keys which will be numbered.
112-
/// \tparam hasht: The type of hashing functor used to hash keys.
113-
template <typename keyt, typename hasht = std::hash<keyt>>
114-
using numberingt =
115-
template_numberingt<std::unordered_map<keyt, std::size_t, hasht>>;
116112

117113
#endif // CPROVER_UTIL_NUMBERING_H

0 commit comments

Comments
 (0)