Line data Source code
1 : #ifndef GENERIC_PARAMETER_H
2 : #define GENERIC_PARAMETER_H
3 :
4 : #include <string>
5 : #include <functional>
6 :
7 : namespace nicole {
8 :
9 : class GenericParameter final {
10 : private:
11 : std::string name_;
12 :
13 : public:
14 0 : explicit GenericParameter(const std::string &name) noexcept : name_{name} {}
15 :
16 0 : [[nodiscard]] const std::string &name() const noexcept { return name_; }
17 :
18 0 : [[nodiscard]] bool operator==(const GenericParameter &other) const noexcept {
19 0 : return name_ == other.name_;
20 0 : }
21 :
22 0 : [[nodiscard]] bool operator<(const GenericParameter &other) const noexcept {
23 0 : return name_ < other.name_;
24 0 : }
25 : };
26 :
27 : } // namespace nicole
28 :
29 : namespace std {
30 : template<>
31 : struct hash<nicole::GenericParameter> {
32 0 : std::size_t operator()(const nicole::GenericParameter& obj) const noexcept {
33 0 : return std::hash<std::string>{}(obj.name());
34 0 : }
35 : };
36 : }
37 :
38 : #endif
|