MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / Integer

Class Integer

12-Advanced Template/code/SFINAE/Dictionary.cpp:65–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63// };
64
65class Integer
66{
67 int num_;
68
69public:
70 Integer(int n) : num_{ n } {}
71 auto GetNum() const noexcept { return num_; }
72 // 不定义operator<=>,只允许进行相等的比较。
73 bool operator==(const Integer &) const = default;
74 // C++23也可以用bool operator==(this Integer, Integer) = default;
75 // 来进行值传递,总之要保持两个参数的类型一样。
76};
77
78template<>
79struct std::hash<Integer>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected